Skip to main content
Research preview. Interfaces, config formats, and CLI commands described here may change before general availability. Reach out on Discord or email help@amika.dev to join the early access program.
Code annotations are rules embedded directly in your source that control how agents can interact with specific symbols. Freeze a function to block all agent edits; attach a prompt to fire context at the agent the moment it touches a method. Because amikalyze enforces these at write time — not by asking a model to remember them — you get a hard guarantee, not a soft suggestion. Two annotation types are available:
  • #amika/frozen — the next symbol is off-limits. Edits to it are blocked.
  • #amika/prompt — when an agent modifies the next symbol, this prompt is injected into the agent’s context for that edit.
Annotations live in regular code comments, so they work in any language and travel with the code in git. amikalyze, the parser and enforcer built into the amika CLI, runs at the points you configure: agent hooks, git hooks, or PR checks.

Comment syntax

Annotations use EDN inside ordinary comments. EDN is used here instead of TOML or JSON because it parses cleanly out of any language’s comment syntax — the #amika/foo tag is a single greppable token that survives wrapped lines and mixed indent. The basic shape is #amika/<name> followed by an optional EDN value:
An annotation applies to the next symbol below it: a function, class, or top-level variable. At the top of a file, it applies to the whole module. amikalyze uses tree-sitter to find the “next symbol”, so language support follows whatever tree-sitter grammars ship with the release. TypeScript, JavaScript, Python, Go, and Rust are the initial targets.

Multi-line annotations

For annotations that span multiple lines of comment, repeat the language’s comment prefix on every line — the parser strips the prefix before reading the EDN value:
Block comments work the same way:

Freeze a symbol

#amika/frozen prevents agents from modifying the symbol that follows.
A frozen symbol is blocked at every enforcement point:
  • Agent hook stops an agent from writing the edit in the first place.
  • Pre-commit hook blocks the commit if a frozen symbol changed, regardless of whether a human or an agent made the edit.
  • PR check fails the PR if a commit modifies a frozen symbol.
Freezes apply to all writers, not just agent hooks. This is intentional — once a symbol is frozen, the only way to change it is through an explicit override, so the rule survives whether the edit came from a model or a person.

Override a freeze

By default, agents will be stopped from modifying wrappedChecksum, unless you override the “frozen-checksum” label:

Attach a prompt to a symbol

#amika/prompt adds an instruction that’s injected into the agent’s context whenever it modifies the symbol below the comment.
The prompt fires once per agent turn that touches the symbol. It’s not a guarantee — the agent can still make a bad change — but it ensures the agent sees the constraint before deciding what to do.

Prompt options

To pass options to the model, wrap the prompt and an options map in parens:

Apply rules across a directory

Inline annotations are good for single symbols. To freeze whole directories or match files by glob, drop a .amikalyze.edn file in any directory of your repo:
.amikalyze.edn applies to the directory it lives in and everything below it. Glob patterns are relative to that directory. If you’d rather keep the file out of the way, .amika/amikalyze.edn works too.

Enable code annotations for a repo

Annotations are processed by the built-in amikalyze check. Turn it on in .amika/config.toml:
With this set, amikalyze runs in its own sandbox on every PR, alongside any other checks you’ve defined in .amika/checks/. See Checks for how the runner works. To enforce annotations on every local edit as well, install the agent hook and the pre-commit hook:
For annotations, the agent hook runs amikalyze on each file write the agent attempts (Claude Code, Codex, OpenCode), blocking the write if it hits a frozen symbol and surfacing prompts inline. amikalyze is fast enough to gate every write — unlike sandboxed checks, which run after the agent’s turn ends. The pre-commit hook is the safety net for any edit — human or agent — that slipped past the agent hook.

Where annotations are enforced

It’s up to you where you enforce annotations. You can run amikalyze directly, or run it at one of these enforcement points: All three run the same amikalyze parser — a symbol frozen locally is frozen in CI.

Next steps

Checks

Set up repo config with an agent

config.toml reference