Skip to content
On this page

How it works ​

The path a rule takes from a source repo to an agent's context, one stage at a time, and what each stage writes. This page is the user-level map: every row links to the page that owns the stage, and the architecture page shows the same path as code.

Five stages ​

stagewhat happensowner
sourceadd fetches the repo's memories/ foldersource layout
storethe fetched files land under ~/.agents/maxims/store/the canonical home
statestate.json records what should be installedState
rule filessync writes one line per memory into each harness's always-loaded filethe rule file
hooka session-start hook runs sync --quietthe session hook

state.json is the only record sync trusts. A rule file on disk is compared to what it should be, never read back as a record, so the next sync repairs a crash or a hand edit.

Two layers, one source ​

text
 always-loaded layer: the rule file           on-demand layer: the memory body
 +-------------------------------------+      +----------------------------------------+
 | - one-liner A   (detail: .../A.md) |----->| A.md  frontmatter, Why, How to apply   |
 | - one-liner B   (detail: .../B.md) |----->| B.md                                   |
 | - one-liner C   (detail: .../C.md) |----->| C.md                                   |
 +-------------------------------------+      +----------------------------------------+
   read by the harness every session            opened by the agent when it wants detail

The one-liner is the memory file's description field, and the rule file is generated from it. One field feeds both layers, so there is nothing to drift; the memory file format owns the fields.

Built from main at 5f6e985Source: docs/how-it-works.md