Rules Reference

This page holds the facts of the rule modules. Read it to look one fact up. For how a module reaches an agent, see Rules. To write a new paths: predicate, see Writing a rule’s paths:.

The rules/ directory holds the toolkit’s just-in-time (JIT) canon. A canon is a set of short reference modules for one area. The main loop is the Claude Code session in which you talk to the agents.

Every module

The column "Read by" says who reads the module. For the rules/agents/ modules, the paths: globs name the agent files, so a module loads when someone edits an agent. The pipelines read those modules on purpose. A row that says "the hook names it" applies only where you registered rules-loader.py by hand. The exact globs are in the matrix on Rules.

Module Predicate in words Governs Read by

Agents canon (rules/agents/)

rules/agents/common.md

You write or edit an agent file or an ft-* skill.

Shell and search discipline, graph-first code discovery, browser verification, report economy, untrusted content as data, evidence, asking the user by position, permission requests, vault and self-tuning.

Every FT agent

rules/agents/context.md

You edit ft-developer, bugfix-agent, the ft-dev skill or this module.

The orchestrator’s own context, the sanctioned reset (CONTEXT_RESET), and where knowledge is written by load cost.

The top-level ft-developer (before Stage 2, at Stage 5, at the diff freeze, at Stage 9), the ft-dev shim, bugfix-agent for turns and the reset, and ft-fix-host for the reset and for long waits

rules/agents/delegation-contract.md

You edit any agent or hooks/delegation-gate.py.

How work is split and handed back: the evidence-pack brief, measurable Definition of Done (DoD), ownership zones, SCOPE_BREACH, the grant table, independent review, the four bounds, ## HANDOFF.

Every agent that dispatches a Task and every agent that receives a brief

rules/agents/human-sdd.md

You edit ft-developer, ft-sdd, the design brief template deploy/templates/SDD.md or price-gate.py.

The human SDD handshake: which path a run takes, the two documents, the ft-sdd step after checkpoint D, what makes a record checked, what the Stage 5 question carries, and the repair after the commit.

The top-level ft-developer only. A slice child, a split group and a merge instance never run ft-sdd: a split group reads §1 and §4 and writes the path none — design split, a merge instance reads §5’s readers and reports delivered not run — split, and a slice child reads nothing

rules/agents/run-journal.md

You edit any agent or an ft-* skill.

The append-only run journal under ~/.local/state/ft-ai-toolkit/run/: what each checkpoint already proved.

The orchestrators that write it, refactor-agent, and every sub-agent whose brief carries its path

rules/agents/tiering.md

You edit an agent or a pipeline skill (the glob lists them one by one).

Model and effort per dispatch, escalation, unit size, slices, who decides, the report lines. It prices a dispatch and never changes what is verified.

ft-developer (Stage 1 and Stage 6), a child in slice mode, bugfix-agent before Phase 4. ft-fix and refactor-agent do not read it.

rules/agents/verification-routing.md

You edit an agent, an ft-fix* skill, a rule in rules/agents/, the router files or hooks/verify-gate.py.

Which verifier lenses run and when: the mandatory core, routed lenses, the no-repeat rule, sequencing, evidence reuse, diff-router.py.

ft-fix (checkpoints 1 and 2), ft-developer (checkpoints D and F), bugfix-agent (it produces the lens ledger)

Bugfix canon (rules/bugfix/): each module carries the never-autoload sentinel

rules/bugfix/dependencies.md

Never matches a file. A pipeline reads it on purpose.

The capability manifest of the bugfix pipeline: each tool, its purpose, how to verify it, how to install it, and the fallback.

ft-fix Stage 0 (the only place that installs, with consent per item); bugfix-agent in a standalone run (self-check only)

rules/bugfix/parity-checklist.md

Never matches a file. You are in reference-parity mode.

Traps when a port must match a reference implementation (the examples are C# to Java): null semantics, defaults, numbers, collections, ordering.

bugfix-agent in Phase 1, parity mode only

rules/bugfix/perf-checklist.md

Never matches a file. You are in performance mode.

The measurement that replaces Gate A, the layers to sweep, the finding format. A perf fix without a before and after delta is not FIXED.

bugfix-agent in Phase 1, performance mode only

Feature canon (rules/feature/)

rules/feature/dependencies.md

Never matches a file. A pipeline reads it on purpose.

The capability manifest of the feature pipeline. Verification is by tool name, not by MCP prefix.

ft-developer Stage 0; sub-agents receive the resulting capabilities map and never re-probe

Code quality (rules/code-quality/)

rules/code-quality/convergent-change.md

You change code or configuration: Java, Kotlin, TypeScript, JavaScript, Python, Go, Rust, C#, HTML, Vue, Svelte, SQL, Liquibase changelogs, .properties, YAML, shell, PowerShell.

Finish the class, not the instance: the reuse check before you write, and the sweep for the same question answered elsewhere.

Every FT agent and the main loop

rules/code-quality/design-principles.md

You write or review non-trivial code in Java, Kotlin, TypeScript, JavaScript, Python, Go, Rust or C#.

SOLID, DRY, KISS and YAGNI as triggers with numeric thresholds. The per-stack standard wins on conflict.

Whoever writes or reviews matching code; the hook names it to the main loop

Database (rules/db/)

rules/db/mysql-oracle.md

You write SQL, migrations or JDBC code in .sql, .java or resources/*/.xml against MySQL or Oracle.

Dialect behavior: timezone and timestamp discipline, MySQL specifics, Oracle specifics, cross-dialect discipline. ft-java-standards §J-DB wins.

Whoever writes matching code; the hook names it to the main loop

rules/db/postgres.md

You write SQL or code against PostgreSQL in ft-internal-tools or ai-agent paths.

PostgreSQL operations: MVCC, migrations without downtime, indexes, types, upsert, locking, pooling. It applies only where a project runs PostgreSQL; the FT product contract is MySQL or Oracle.

Whoever writes matching code in those paths

rules/db/schema-design.md

You design or review a table, entity, migration or schema in SQL, Liquibase, Alembic, Prisma, SQLAlchemy or a Java entity package.

How data is laid out: keys, relations, constraints, history, evolution. ft-java-standards §J-DB wins.

ft-developer reads it before the data model of the design brief, because no .sql file exists at design time; otherwise the hook names it

Deploy (rules/deploy/)

rules/deploy/docker.md

You write or review a Dockerfile*, a .j2, .tpl or .tmpl template, a docker-compose*.yml or a .dockerignore.

The two-file build pattern (Dockerfile for local, Dockerfile.simple for CI), base images, image hygiene, layered JARs, JVM in a container, registry tagging. The image-packaging standard is the skill ft-docker-standards.

Whoever writes matching code; the hook names it to the main loop

rules/deploy/kubernetes-dev.md

You write Kubernetes YAML, a Chart.yaml or a kustomization.yaml.

Kubernetes as a dev-only environment: probe semantics, resources, graceful shutdown, config and secrets. QA and production run plain Docker.

Whoever writes matching code; the hook names it to the main loop

Dependencies (rules/deps/)

rules/deps/dependency-change.md

You edit a dependency manifest: pom.xml, Gradle files, package.json, requirements*.txt, pyproject.toml, Pipfile, go.mod, Cargo.toml, *.csproj, Gemfile, composer.json.

Check the current library documentation (the context7 MCP server first, not memory) before the edit lands. The trigger is the observable manifest edit, not a question the model never reports.

The main loop and any agent

Security (rules/security/)

rules/security/backend-security.md

You touch auth, secrets, crypto, HTTP endpoints, parsing, SQL, files or dependencies in .java, .ts, *.xml, pom.xml or Gradle files.

The deep reference behind the blocking baseline of ft-java-standards §J20 and §J15. A violation is a blocking [MUST-FIX] review finding.

Whoever writes matching code; the hook names it to the main loop

UI/UX (rules/ux/): described on UI/UX

rules/ux/design-skill-routing.md

You edit a UI file: script, markup or style files such as .js, .ts, .tsx, .vue, .svelte, .html, .css and .scss.

The routing table from a design property to the installed design skill. See UI/UX.

See UI/UX

rules/ux/user-visible-dod.md

The outcome is something a person reads, sees or decides from. The globs cover Java, Kotlin, TypeScript, JavaScript and Python files, among others.

The Definition of Done for user-visible work. See UI/UX.

See UI/UX

Optional: the rules-loader hook (not installed)

deploy/templates/hooks/rules-loader.py is a stricter gate on top of the native loading. A hook is a script that Claude Code runs at a fixed event, here PreToolUse, before a tool call. The hook predates native loading in Claude Code. The installers neither copy it nor register it in settings.json. A module loads natively without it. If you register the hook by hand, it behaves as follows.

Question Answer

Registration

Copy the file to ~/.claude/hooks/. In settings.json, add one entry under hooks.PreToolUse, with the matcher Edit|Write|MultiEdit|NotebookEdit|Bash|Skill|Agent|Task and the command python3 ~/.claude/hooks/rules-loader.py.

Event

PreToolUse, before a write. It reads Edit, Write, MultiEdit, NotebookEdit and the write targets of a Bash command (>, >>, tee, sed -i, cp, mv, install). It also reads Skill and Agent/Task calls to learn that a standard is already dispatched.

What it does

It denies the write once and names the modules that govern the file, with their size in KB. It does not paste the modules in. The session reads the modules that its change touches, then retries the write.

How often

Once per module per session, and once per standard. It keeps the names already shown in ~/.local/state/ft-ai-toolkit/rules-loader/<session_id>.

Standard

For .java and .kt it names ft-java-standards. For .component.ts, .service.ts and the other Angular file shapes (module, directive, pipe, guard, resolver) it names ft-angular-standards. For .py it names ft-python-standards. For a Dockerfile it names ft-docker-standards. It tells the session to dispatch the skill, because a skill is invisible to paths:. A dispatched standard settles the question for the session. A dispatch of ft-java-coding-agent, ft-angular-coding-agent, ft-python-coding-agent, ft-developer, bugfix-agent or refactor-agent counts as a dispatch of the standard.

Who is exempt

A sub-agent. It arrives with a brief, and a deny in the middle of a pipeline breaks the run. The main loop is the measured gap, so the hook targets the main loop.

What it skips

Scratch and build paths: node_modules, .git, dist, build, target, vendor, __pycache__, virtual environments, scratchpad, /tmp, /private/tmp, and the toolkit’s own installed copies under .claude/rules, hooks, agents and skills.

Opt out

A module whose paths: holds the sentinel __explicit-read-only-never-autoload__/** never matches, because the sentinel is a value that no file path has. A pipeline reads such a module on purpose. For this hook, a module with no frontmatter does not match either. Claude Code itself loads a module without paths: at launch.

Failure

It fails open. Any internal error exits 0 silently, because a gate that blocks editing when its own state is unreadable gets switched off.

The hook finds the nearest .claude/rules/ directory above the target file and names its modules in the same deny message.

  • The walk stops at a directory that holds a .git entry. This covers a worktree, where .git is a file.

  • A .claude/rules/ directory with no .md file is not a canon, so the walk continues above it.

  • The personal directory ~/.claude/rules is never treated as a repository directory.

  • A repository glob is matched against the path relative to the directory that holds .claude/. The glob frontend/js/.js matches <repo>/frontend/js/app.js. A */ glob also matches the absolute path.

  • The hook matches with Python fnmatch, so a also crosses /. In the native loading, a stays inside one folder.