boring-marketing — Claude Code hook: isolate brand workspaces
boring-marketing is a Claude Code hook that isolates brand workspaces under brands/ and logs created campaign assets. It stops agent tools from touching the wrong client folder.
MIT ★ 778 updated 2026-11-16
/plugin marketplace add boringmarketer/boring-marketing-skills
/plugin install boring-marketing@boring-marketing-skillsWhat boring-marketing does
The boring-marketing hook bundle enforces client boundaries across agent actions. During PreToolUse, it inspects file targets for Write and Edit calls. The script reads the active client identifier from brands/active and halts tool execution with exit code 2 whenever the agent tries to edit a different brand directory.
A matching safeguard monitors Bash commands, checking for mentions of brands/<slug>/ via regex. On PostToolUse, whenever a file is written into campaigns/, the hook registers the path inside the active brand's assets.md manifest with the current date.
Every hook command relies on python3 in the system environment and runs with a 10-second timeout.
What it helps with
- prevent writes to inactive client directories under brands/
- block shell commands targeting another client's workspace
- track campaign outputs automatically in assets.md
Example prompts for the agent
- Set the active client slug in brands/active to north-star
- Draft an outreach email inside campaigns/q1-cold-email/
- Update copy in brands/acme-corp/positioning.md
How to install boring-marketing
1Plugin marketplace
/plugin marketplace add boringmarketer/boring-marketing-skills/plugin install boring-marketing@boring-marketing-skills2Manually: put the files in place
.claude/settings.jsonThe hooks block: event (PreToolUse, PostToolUse, Stop…) → command. Personal ones go to ~/.claude/settings.json
Step by step, with commands for each platform: Claude Code hooks: what they are, where to configure them, how to block a risky command
Questions about boring-marketing
How to install boring-marketing in Claude Code?
Run /plugin marketplace add boringmarketer/boring-marketing-skills, then run /plugin install boring-marketing@boring-marketing-skills, or add the hook definition directly into .claude/settings.json.
What does boring-marketing do?
It intercepts agent operations to isolate client folders in brands/ and logs newly written files from campaigns/ into assets.md.
What is required to run boring-marketing?
It requires python3 installed on the host machine to execute inline validation scripts.
Source text
hooks.json · MIT
Hooks bundle shipped with the boring-marketing plugin for Claude Code.
Free marketing skills for your AI agent: research, positioning, copy, pages, SEO, AI search, ads, email and content, plus a local-business pack (Google profile, reviews, local pages, call tracking). Built from real campaigns. Every skill works without a paid tool. MIT licensed.
Triggers on: PreToolUse, PostToolUse.
```json
{
"hooks": {
"PreToolUse": [
{
"matcher": "Write|Edit",
"hooks": [
{
"type": "command",
"timeout": 10,
"command": "python3 -c '\nimport json,sys,os\ntry:\n d=json.load(sys.stdin)\nexcept Exception:\n sys.exit(0)\np=(d.get(\"tool_input\") or {}).get(\"file_path\") or \"\"\ncwd=d.get(\"cwd\") or os.getcwd()\nif not p:\n sys.exit(0)\ntry:\n rel=os.path.relpath(p,cwd).split(os.sep)\nexcept ValueError:\n sys.exit(0)\nif len(rel)<2 or rel[0]!=\"brands\" or rel[1]==\"active\":\n sys.exit(0)\nact=os.path.join(cwd,\"brands\",\"active\")\nif not os.path.isfile(act):\n sys.exit(0)\nslug=open(act,encoding=\"utf-8\").read().strip()\nif slug and rel[1]!=slug:\n print(\"wrong client: this session is scoped to \"+slug+\"; do not switch clients unless the user asked for \"+rel[1]+\" - stop and tell the user\",file=sys.stderr)\n sys.exit(2)\n'"
}
]
},
{
"matcher": "Bash",
"hooks": [
{
"type": "command",
"timeout": 10,
"command": "python3 -c '\nimport json,sys,os,re\ntry:\n d=json.load(sys.stdin)\nexcept Exception:\n sys.exit(0)\ncmd=(d.get(\"tool_input\") or {}).get(\"command\") or \"\"\ncwd=d.get(\"cwd\") or os.getcwd()\nact=os.path.join(cwd,\"brands\",\"active\")\nif not cmd or not os.path.isfile(act):\n sys.exit(0)\nslug=open(act,encoding=\"utf-8\").read().strip()\nif not slug:\n sys.exit(0)\nhits={m for m in re.findall(r\"brands/([A-Za-z0-9._-]+)/\", cmd) if m not in (\"active\", slug)}\nif hits:\n print(\"wrong client: this session is scoped to \"+slug+\"; this command touches brands/\"+sorted(hits)[0]+\"/ - do not switch clients unless the user asked; stop and tell the user\",file=sys.stderr)\n sys.exit(2)\n'"
}
]
}
],
"PostToolUse": [
{
"matcher": "Write",
"hooks": [
{
"type": "command",
"timeout": 10,
"command": "python3 -c '\nimport json,sys,os,datetime\ntry:\n d=json.load(sys.stdin)\nexcept Exception:\n sys.exit(0)\np=(d.get(\"tool_input\") or {}).get(\"file_path\") or \"\"\ncwd=d.get(\"cwd\") or os.getcwd()\nif not p:\n sys.exit(0)\ntry:\n rel=os.path.relpath(p,cwd)\nexcept ValueError:\n sys.exit(0)\nif rel.split(os.sep)[0]!=\"campaigns\":\n sys.exit(0)\nbrand=os.path.join(cwd,\"brand\")\nactive=os.path.join(cwd,\"brands\",\"active\")\nif os.path.isfile(active):\n slug=open(active,encoding=\"utf-8\").read().strip()\n if slug:\n brand=os.path.join(cwd,\"brands\",slug)\nif not os.path.isdir(brand):\n sys.exit(0)\nassets=os.path.join(brand,\"assets.md\")\nposix=\"./\"+rel.replace(os.sep,\"/\")\nprev=open(assets,encoding=\"utf-8\").read() if os.path.exists(assets) else \"\"\nif posix in prev:\n sys.exit(0)\nwith open(assets,\"a\",encoding=\"utf-8\") as f:\n f.write(\"- [\"+datetime.date.today().isoformat()+\"] [hook:asset-manifest] \"+posix+\"\\n\")\n'"
}
]
}
]
}
}
```
© James Dickerson (@boringmarketer) · MIT · boringmarketer/boring-marketing-skills