| SR-F-01 (Workspace Repository) |
One repository holds the shared assistant configuration and no application code. Each project is its own git repository, cloned as a subfolder and listed in the workspace .gitignore, so the workspace never tracks project files. Git commands for a project run as git -C <project> .... |
CLAUDE.md, .gitignore |
BR-1.1 |
| SR-F-02 (Sessions Run at the Root) |
Every Claude Code session runs from the workspace root, where the shared rules, skills and graphify hooks load. In the dev container a claude shell function, sourced from /etc/bash.bashrc, starts Claude Code at the root from any folder. A UserPromptSubmit start-guard hook refuses every prompt, with exit code 2, when the session’s project folder is not the root recorded at build time in /etc/claude-code/workspace. When no root is recorded, it allows the prompt. |
.claude/hooks/start-guard.js, .devcontainer/shared/install-claude-policy.sh |
BR-1.1, BR-1.2 |
| SR-F-03 (Layered CLAUDE.md) |
Instructions are read in the order: workspace CLAUDE.md, then the project’s CLAUDE.md, then the module’s CLAUDE.md. The more specific file wins for its own scope. A project CLAUDE.md holds only what is specific to that project and never copies a shared rule. |
CLAUDE.md, <project>/CLAUDE.md |
BR-1.1, BR-1.2 |
| SR-F-04 (Path-Scoped Rules) |
Shared rules live in .claude/rules/. A rule with a paths: frontmatter list loads only when matching files are in play, such as coding patterns for source files, infrastructure rules for *.tf, *.opref and *.opnames, and the ecommerce constraints for ecommerce-shoppee/**. Rules without paths: (security and op:// references) load on every task. |
.claude/rules/*.md |
BR-1.2 |
| SR-F-05 (On-Demand Skills) |
Long procedures are skills in .claude/skills/<name>/SKILL.md. A skill’s description tells the assistant when to load it, and the body loads only then. Supporting files, templates and audit scripts sit beside SKILL.md. Current skills: ecommerce-shoppee, dev-container-tofu, infra-docs, drawio-diagrams, publish-review, github-repo-hardening, graphify. |
.claude/skills/ |
BR-1.2, BR-1.10 |
| SR-F-06 (Deny Rules) |
permissions.deny in .claude/settings.json refuses reading or editing .env files and key material (*.pem, *.key, *.p12, service-account and Firebase admin JSON), environment dumps (printenv, env, set, export -p, /proc), keychain retrieval, every op subcommand except run, and docker exec/inspect/top. |
.claude/settings.json |
BR-1.3 |
| SR-F-07 (Env-Guard Hook) |
A PreToolUse hook runs before every Read, Grep, Glob and Bash call. It blocks with exit code 2 when a path, pattern or command names secret files or key material, dumps the environment, reads a sensitive variable, or calls op in any form other than the one runner around tofu and wrangler. A sensitive variable may only be presence-checked with ${VAR:+x}. |
.claude/hooks/protect-env.js |
BR-1.3 |
| SR-F-08 (Scope-Guard Hook) |
A PreToolUse hook on Bash returns permissionDecision: "ask" for git clone, git push, ssh/scp/sftp/rsync, curl/wget, any GitHub CLI command that is not read-only, and git fetch/pull/remote/submodule against a repository outside the workspace. It asks and never blocks: the person decides. |
.claude/hooks/scope-guard.js |
BR-1.5 |
| SR-F-09 (Locked Policy in the Dev Container) |
When the dev container is built, the whole of .claude/settings.json is copied to root-owned /etc/claude-code/managed-settings.json, with every hook pointed at a root-owned copy in /etc/claude-code/hooks/. The build stops if a hook would still run a workspace file. The managed policy sets allowManagedHooksOnly, allowManagedPermissionRulesOnly and permissions.disableBypassPermissionsMode: "disable", so hooks and permission rules from user, project and local settings, plugins and --allowedTools are ignored. Managed settings outrank every other source, and the unprivileged vscode user that runs the assistant cannot edit them. A change reaches them only through review, merge and a container rebuild. |
.devcontainer/shared/install-claude-policy.sh, post-create.sh |
BR-1.4 |
| SR-F-10 (Unprivileged Dev Container) |
The assistant runs in a dev container as vscode, which has no sudo after hardening. Each container clones only the repositories named in its start command. |
.devcontainer/<name>/devcontainer.json, .devcontainer/shared/harden-user.sh, sync-projects.sh |
BR-1.6 |
| SR-F-11 (Secrets by Reference) |
Sensitive configuration is written as op://<vault>/<item>/<field> references: a layer’s run lists the variable names it needs in a committed .opnames file and takes their references from its 1Password Environment, and a workflow names each reference itself. op run resolves them into one child process only. The assistant may run op run around the allowed tofu and wrangler subcommands and nothing else from the op CLI. |
.claude/rules/12-config-pointer-resolution.md, protect-env.js |
BR-1.3 |
| SR-F-12 (Knowledge Graph) |
A local graphify graph is kept in graphify-out/, which is gitignored so each clone builds its own. Codebase questions go to graphify query, path or explain first. graphify hook-guard hooks on Read/Glob and Bash/Grep steer broad searches to the graph. After code changes, graphify update . refreshes it with no API cost. .graphifyignore keeps docs, build output and secret files out of the index. Each dev container installs the CLI root-owned at the skill’s pinned version, and a failed install never stops the hardening steps. |
CLAUDE.md, .claude/settings.json, .graphifyignore, .devcontainer/shared/install-graphify.sh |
BR-1.7 |
| SR-F-13 (Documentation Pipeline) |
Every feature in every project is documented in <site-repo> under appDocs/app-articles-<project>/, in the order BRD, SR, ADR, Architecture, each written against the real code. A gap found is recorded in the project’s private register, never on a published page. Before publishing, /publish-review checks the content for real identifiers, weaknesses, attack-useful detail, copied code and duplicated facts. Code and docs are separate commits or pull requests that link to each other. |
CLAUDE.md, <site-repo>/CLAUDE.md |
BR-1.8 |
| SR-F-14 (Private Weakness Register) |
Known weaknesses of this workspace are recorded privately in its own repository and never published. |
Workspace repository |
BR-1.9 |
| SR-F-15 (New Project Checklist) |
A new project is cloned as its own repository, added to .gitignore, given its own CLAUDE.md and a row in the workspace Projects table, and given an applications/<project>.md entry and an appDocs section set registered in lib/applications.ts. |
CLAUDE.md (“Adding a new project”) |
BR-1.10 |
| SR-F-16 (Commit Secret Scan) |
Every commit made in a dev container, in the workspace and in every project repository, is scanned by a pre-commit hook running gitleaks protect --staged --redact. A finding stops the commit. When the container is built, gitleaks is installed, a root-owned copy of the hook goes in /usr/local/share/git-hooks/, and git’s system core.hooksPath points there. If gitleaks is missing, the hook refuses the commit instead of skipping the scan. |
.githooks/pre-commit, .devcontainer/shared/install-commit-scan.sh |
BR-1.3 |