Expand description
Agent-rules projection (decided.services.agent_rules) — decided export --agent-rules [--check], per PORT-CONTRACT.d/17 §3.
Distils the live corpus (Accepted, non-retired decisions) into a
drift-guarded managed block spliced into per-client agent-context files.
The provenance digest is sha256 over the canonical JSON serialization of
the ordered entries (sort_keys, separators (",", ":"),
ensure_ascii=False) — any byte deviation cascades into --check drift,
so the canonical dump must match CPython exactly (pyjson::dumps_canonical_sorted).
Structs§
- Agent
Rules File Result - Agent
Rules Result - The outcome of a generate or check run (mirrors
AgentRulesResult). - Agent
Rules Target - One per-client target file (selector + root-relative path), in the
oracle’s fixed
TARGETSorder.
Constants§
Functions§
- agent_
rules_ root _agent_rules_root(directory, out)— explicit--outwins; else the parent of adecisions/-named directory (or.when that parent is.), else the directory itself.- check_
agent_ rules check_agent_rules(directory, root, clients)— never writes; compares each present target’s embedded digest to the live projection.- generate_
agent_ rules generate_agent_rules(directory, root, clients)— write/update the managed block in each target underroot. Writes are skipped when the embedded digest already matches (idempotent). An io error surfaces asErrfor the caller’scannot write under {root}usage error.- py_
path_ str str(PurePosixPath(p)): duplicate slashes and.components collapse, a trailing slash drops,""becomes"."; a leading//(exactly two slashes) is preserved,/+ otherwise collapses to one.