Expand description
decided-engine — experimental Rust port of the decided-core engine
(roadmap:native-engine-spike). The Python tree at src/ is the frozen
oracle; the binding behavior contract is rust/PORT-CONTRACT.md.
Module map (keep cross-module surface minimal):
pycompat: CPython string/float/round/repr semantics, table-driven from the packagedassets/spec/pycompat-tables.json.pyjson: the Pythonjson.dumps-shaped writer (indent=2 and JSONL).frontmatter: bounded PyYAML-1.1 SafeLoader subset.markdown: CommonMark block-boundary tokenizer (headings + inline raw).spec: artifact specs embedded from the vendored rac-spec registry.walk: corpus discovery in component-wise sorted-path order.parse: file -> parsed artifact (frontmatter + sections + fields).classify: deterministic classification over specs.identity: artifact identifiers and the id grammar.validate: structural validation and the finding catalog.relationships: edge extraction, resolution, validation issues.resolve: BM25F + RRF search with pinned f64 operation order.gitinfo: git-derived recency/staleness via the real git CLI.budget: the ADR-033 per-response character budget and truncation.consent: the ADR-041/086 sharing-consent record (telemetry.json).telemetry: Guide telemetry log read-back (ADR-040, mcp-stats).usage: CLI usage log read-back + consent-gated recorder (ADR-046).sha256: FIPS 180-4 digest (eval corpus/query-set hashes).skill: bundled agent skills — registry + embedded-asset install.hook: bundled git hooks — registry + embedded-asset install.eval: the ADR-066 grounding retrieval benchmark and gate.portal: the vendored Portal shell + export-HTML assembly.agent_rules: the ADR-067 agent-rules projection and drift gate.okf: the ADR-048 OKF bundle projection (git-derived recency join).revisions: ADR-043 git-revision materialization (git archive+ tar).compare: repository state comparison (watchkeeper’s load/compare).intent: deterministic intent findings over a comparison.watchkeeper: the watchkeeper report and review verdict.output: human/JSON/SARIF renderers per command.commands: CLI command entry points (argv already parsed).cli: argv parsing and exit codes matching the oracle’s argparse surface (PORT-CONTRACT.d/01).
Modules§
- agent_
rules - Agent-rules projection (
decided.services.agent_rules) —decided export --agent-rules [--check], per PORT-CONTRACT.d/17 §3. - budget
- Per-response character budget (ADR-033) — a port of
src/asdecided/mcp/budget.py(ORACLE-NEXT revision, which adds theitemsrule). Shared by the CLI retrieve surface (commands::cmd_retrieve) and the decided-mcp server. - classify
- Deterministic classification (
decided.core.classification), per PORT-CONTRACT.d/04 §2. - cli
- CLI argv surface (PORT-CONTRACT.d/01).
- commands
- Command orchestration: walk -> parse -> classify -> validate -> render. Output is order-deterministic.
- compare
- Repository state comparison (
decided.services.compare):load_statewalks one directory into a fully analysedRepoState;compare_statesderives every delta between two states — changed artifacts, validation delta, relationship delta, statistics delta. Artifacts are matched by corpus-relative path (os.path.relpath(entry.path, directory)), so the two states may live anywhere on disk (a working tree and a materialized git revision, or two fixture directories). A rename reports as removed plus added. - consent
- Usage-sharing consent (
src/asdecided/consent.py) — ADR-041, ADR-086. - coverage
- Traceability coverage report (
decided.services.coverage) — typed completeness gaps derived from the resolved relationship graph. Advisory, never a build failure:decided coveragealways exits 0 on a real directory. Three gap classes, one type and one expected edge direction each: - delta_
generation - Preview-only P6 base-plus-delta document generation.
- derived
- The derived read-model for one corpus snapshot (ADR-099/ADR-103).
- derived_
cache - Content-addressed derived-index cache (ADR-099/ADR-112) — port of
services/derived_cache.pyDerivedIndexCache.load_or_buildplus the stat-manifest freshness rungs ofservices/freshness.pythe one-shot path consumes (INDEX-PLAN B3). - diff
- AST diff (
decided.services.diff): compare two parsed products and classify the changes. Pure AST work — no git, no revisions, no raw-text diffing. - doctor
- Repository health diagnostic (
decided.services.doctor, v0.23.0 WS3) plus its two service dependencies with no prior Rust port: mentioned-but-unlinked reference detection (decided.services.links, ADR-082) and the six injection-style content heuristics (REQ-005). - eval
- Grounding retrieval benchmark —
decided eval(PORT-CONTRACT.d/15). - export
- Corpus export (
decided.services.export) — deterministic viewer/graph/documents projections of a corpus. One walk, shared across projections; no timestamps. - freshness
- Server-lifetime serving freshness (ADR-105) — port of
services/freshness.pyFreshnessTrackerfor the long-lived MCP server (INDEX-PLAN B6). - frontmatter
- Frontmatter parsing — port of
src/rac/core/frontmatter.pyplus the bounded PyYAML-1.1 SafeLoader subset it rides on (PORT-CONTRACT.d/02). - gate
- Policy-aware unified enforcement (
decided.services.gate, v0.21.14 / ADR-049) plus the STRICT.decided/config.yamlloaders it alone consumes (decided.services.init.load_enforcement_policy/load_overrides, the raising paths). - gitinfo
- Git-derived recency and staleness — a port of the git touchpoint in
src/asdecided/services/recency.py, per PORT-CONTRACT.d/08 §4. - herald
- Native deterministic renderer for Herald’s governing-decisions PR comment.
- hook
- Bundled git hooks —
decided hook(PORT-CONTRACT.d/15). - identity
- Artifact identity (
decided.core.identity), per PORT-CONTRACT.d/04 §3. - improve
- Artifact improvement (
decided.services.improve): deterministic, schema-driven guidance. Advisory and read-only — reports missing required/recommended sections with schema-defined guidance questions. - index
- Repository index —
decided index(services/index.py, INDEX-PLAN B1). - index_
format - Binary segment codec for the persistent index store (ADR-104).
- index_
store - Persistent memory-mapped index store (ADR-104) — port of
services/index_store.pyperrust/spec/index-store-format.md. - inspect
- Artifact inspection (
decided.services.inspect): classify one document and report its structure, or aggregate types across a directory. - intent
- Deterministic intent analysis (
decided.services.intent): pure, explainable checks over aRepositoryComparison— measurable requirements becoming vague, mandatory language weakening, ambiguous wording arriving, acceptance criteria / success measures disappearing, relationship impact, and new scope without supporting context. Token-boundary text matching and parsed-section comparison only; no semantic scoring. - markdown
- Markdown -> Product extraction (PORT-CONTRACT.d/03, parity landmine #2).
- mdhtml
- CommonMark -> HTML rendering for
exportbody_html, byte-matching markdown-it-py 4.2.0’s"commonmark"preset with{"html": False}. - okf
- OKF bundle export (
decided.output.okf+ the recency join) —decided export --okf, per PORT-CONTRACT.d/17 §4. - output
- Output renderers (validate + relationships surfaces), per
PORT-CONTRACT.d/07: human text (code-point padding, TTY-gated ANSI),
--jsonviapyjson::dumps_indent2, and SARIF 2.1.0. - parallel_
build - Parallel cold build of the derived read-model (ADR-107/ADR-108).
- parse
- File -> parsed artifact: the oracle’s
decided.core.markdown.parse/parse_filecomposition of the markdown body walk (markdown.rs) with the frontmatter envelope (frontmatter.rs), per PORT-CONTRACT.d/04 §0 and PORT-CONTRACT.d/09 §1.7. - portal
- Portal HTML assembly (
decided.output.portal) — inject the export payload into the vendored shell, per PORT-CONTRACT.d/17 §2. - portfolio
- Repository intelligence summary (
decided.services.portfolio), the byte-derived coredecided reviewcomposes. Walk -> per-artifact validation/completeness -> relationship summary + gate -> attention items + health score. - pycompat
- CPython 3.11 string / float / round semantics (PORT-CONTRACT.md §“Python- compatibility primitives”, PORT-CONTRACT.d/07 §1.4–1.5).
- pyjson
- Python
json.dumps-shaped writers overserde_json::Value(PORT-CONTRACT.d/07 §1). - read_
model - Store-served search (ADR-104) —
decided findanswered from the memory- mapped base, byte-identical to the fresh walk (INDEX-PLAN B3). - relationships
- Relationship extraction and validation (
decided.services.references,decided.services.relationships,decided.core.relationship_types), per PORT-CONTRACT.d/05. - rename
- Safe artifact-id rename —
decided rename(PORT-CONTRACT.d/16 §4). - resolve
- Resolve & search (
decided resolve,decided find) — a port ofsrc/asdecided/services/resolve.py(+ the index construction insrc/asdecided/services/index.py), per PORT-CONTRACT.d/06. - retrieve
- Compound deterministic grounding retrieval (
decided retrieve, ADR-113) — a port ofsrc/asdecided/services/retrieve.pyandsrc/asdecided/services/scope.py/scope_paths.py(the scope-binding channel) from thegrounding-retrieval-surfacebranch (oracle0.1.dev55+gf2091befd). The ADR-033 response budget (serialization + truncation) lives incrate::budget. - review
- Repository review (
decided.services.review) — the prioritized, actionable reportdecided reviewrenders. Composes the portfolio summary, git-native drift advisories, and an optional write-cadence nudge. - revisions
- Git revision materialization (
decided.services.revisions) — the only git-consuming module of the watchkeeper path (ADR-043). A revision name becomes a temporary directory holding the corpus subpath at that revision, viagit archive --format=tar(never mutates.git: no worktree registration, no locks) piped through a minimal in-process tar reader (no tar binary, no new dependencies). - scaffold
- Scaffold writes —
decided new,decided init,decided quickstart,decided migrate metadata(PORT-CONTRACT.d/16). - sentry
- Deterministic decision-to-code enforcement.
- sha256
- SHA-256 (FIPS 180-4) — the digest behind eval’s
corpus_hash/query_set_hash(hashlib.sha256insrc/asdecided/services/eval.py). Hand-rolled to keep the workspace dependency-free (same posture as the harness glob); verified against the FIPS test vectors below. - skill
- Bundled agent skills —
decided skill(PORT-CONTRACT.d/15). - spec
- Artifact specs, loaded from the vendored, language-neutral asdecided-spec registry embedded at build time. Field, section, and map order are preserved everywhere (PORT-CONTRACT.d/04 §1, PORT-CONTRACT.d/09, PORT-CONTRACT.d/05 §3.1).
- stats
- Portfolio statistics (
decided.services.stats), per PORT-CONTRACT.d/09 §2. - telemetry
- Guide telemetry read-back (
src/asdecided/mcp/telemetry.py) — ADR-040. - timing
- Opt-in, stderr-only phase timing for performance diagnosis.
- usage
- CLI usage telemetry (
src/asdecided/usage.py) — ADR-046, content-free, consent-gated, local-only. - validate
- Structural validation (
decided.core.validation), severity overrides (decided.core.overrides), OKF conformance (decided.services.okf_conformance), and the.decided/config.yamlloaders (decided.services.init) — per PORT-CONTRACT.d/04 §4-6. - walk
- Corpus file discovery — a byte-exact port of
find_markdown_files(src/rac/core/fs.py) and the walk seam, per PORT-CONTRACT.d/09 §1. - watchkeeper
- Watchkeeper report assembly (
decided.services.watchkeeper): resolve the base and head of a comparison — each an existing directory or a git revision materialized throughrevisions— load both states, compare, run intent analysis, and derive the deterministic review verdict.to_dict(rendered inoutput.rs) is the stable JSON contract (ADR-007, schema_version “1”).