跪拜 Guibai
← Back to the summary

AGENTS.md Rules That Survive Past the Chat Pane: Jin's Deterministic Injection Chain

Jin open source: https://github.com/ZYF93/Jin | Installers for three platforms in Releases

Now many coding agents support "rules files": write an AGENTS.md, put a few project conventions, and the model "will try to follow". After using it for a while, you'll discover an awkward fact—the exact step where rules take effect, and at what granularity, is uncertain.

In Jin, I turned this into a deterministic chain: two layers of rules files, injected at three stages, all the way down to method level.

Two layers, each with its own responsibility

Layer Location What it's for
Project rules repo root AGENTS.md layering constraints, naming, test requirements, domain knowledge (follows the repo, shared by teammates)
Global rules app data directory (edit directly in settings) personal preferences: language, reply style, common habits (follows the machine, not in the repo)

Each call reads these live—edit the file, and the next scan / planning / implementation immediately uses the new rules, no restart needed. A single layer over 16,000 characters will be truncated, to keep rules from bloating every request.

Injected into which three steps?

1. Semantic scan refinement. The first scan isn't just counting files; it has the model refine the architecture: each file's responsibility, kind classification, domain labels, and the responsibility of each method/field/property (facet). Rules take effect here—if you write "always reply in Chinese", the module responsibilities and method responsibilities shown in the review UI are in Chinese.

2. Planning. Task breakdown, acceptance criteria, architecture change proposals are all generated under the constraints of the rules.

3. Implementation. Every implementation worker's system prompt carries the rules; the worker also receives a prominent "Facet-level intent (must satisfy)" block listing the intent of each method it is responsible for, and is required to self-check each one before finishing.

Why "symbol-level" matters

If rules only affect chat replies, they're decoration. What actually determines what code looks like is what each method is supposed to do. So Jin hands facet (method/field/property) intent to the model, then verifies it against LSP/structural facts: members that don't exist in the code are discarded however plausible the model makes them sound, and never enter the architecture.

That's what "rules down to symbol level" means: not trusting the model, but letting rules enter every step that produces code, with fact-checking as a safety net.

A counterexample to show the difference

Suppose your rule says:

Data access always goes through the repository layer; components must not query the database directly.

Rules are not hints for the model; they are constraints for the process.

What rules can't do (also made clear)

Want to try it: https://github.com/ZYF93/Jin (Windows / macOS / Linux installers available, ready to use).