afara injectWrites the architecture patterns that apply to this repository into the instruction file your AI coding tool reads at the start of every session. The tool then follows your company’s rules while it writes code here.
afara inject # the file of the AI tool you use
afara inject --tool codex # a particular tool's file
afara inject --all-tools # the file of every installed tool
afara inject --remove # take the patterns out again
Flags:
| Flag | Description |
|---|---|
--tool <tool> |
Write this tool’s file: claude, codex or gemini. The tool does not need to be installed, so you can write a file for teammates who use a different one. |
--all-tools |
Write the file of every AI tool installed on this machine. Cannot be combined with --tool. |
--remove |
Take the patterns out of the file instead of writing them. Does not need you to be signed in. |
Without --tool or --all-tools, Afara writes the file of the tool you use: the one chosen with afara model, or else the first one installed.
The file is written at the root of the repository:
| Tool | File |
|---|---|
| Claude Code | CLAUDE.md |
| Codex CLI | AGENTS.md |
| Gemini CLI | GEMINI.md |
The patterns are the ones afara patterns lists for this repository: those that name it, and those that apply to every repository. They go in a marked block, enterprise patterns first:
<!-- afara:patterns:start (managed by `afara inject`; run it again to update, edits here are overwritten) -->
## Architecture patterns
These are the organisation's architecture rules for this repository (acme/checkout), from Afara. Follow them when you write or change code here; if a change cannot follow one, say so and why.
### Hexagonal architecture (enterprise pattern)
- Domain code imports nothing from infrastructure
- Adapters depend on ports
### Payments service rules (service pattern)
- Every charge is idempotent on a client-supplied key, so a retried request never charges twice.
<!-- afara:patterns:end -->
inject again replaces only the block, so it is safe to run whenever the patterns change. If nothing changed, the file is not touched (already up to date).afara inject --remove takes the block out, along with the blank line before it. If the file held nothing but the block, the file is deleted.
If no patterns apply to the repository any more, a plain afara inject also removes an old block, and says there is nothing to inject.
CLAUDE.md (Claude Code): wrote 2 patterns.
AGENTS.md (Codex CLI): already up to date.
Commit CLAUDE.md so everyone's AI tool gets the same rules. Run `afara inject` again when the patterns change.
Commit the file. That way everyone who works in the repository, and every AI tool run in CI, gets the same rules.
origin remote on GitHub, which is how Afara knows which patterns apply.--remove.inject stops rather than guess (it has an Afara start marker but no end marker). Remove the rest of the block by hand, then run it again./inject, with the same flags: /inject --all-tools.