Files
msd-core/examples/dynamic-context-management
Jakub Zych 12ee75a509
Some checks failed
Tests / PR mergeability (push) Successful in 1m37s
Tests / Base branch health (push) Successful in 11s
Tests / Detect test scope (push) Successful in 17s
Tests / lint-tests (push) Failing after 2m16s
Tests / plugin-validate (push) Successful in 1m6s
Tests / test (ubuntu-latest, 24, shard 1/3) (push) Failing after 25s
Tests / test (ubuntu-latest, 24, shard 2/3) (push) Failing after 20s
Tests / test (ubuntu-latest, 24, shard 3/3) (push) Failing after 20s
Tests / test (ubuntu-latest, 24) (push) Failing after 19s
Tests / test (inert CI) (push) Has been skipped
Tests / QA loop walk (smell ratchet) (push) Failing after 19s
Tests / Coverage gate (merged shards) (push) Has been skipped
Tests / Publish emitted-baseline artifact (push) Has been skipped
Dismiss Unauthorized PR Approvals / dismiss-unauthorized-approval (push) Successful in 9s
Close Draft PRs (sweep) / Sweep open draft PRs (push) Successful in 8s
Tests / conformance test (macos-latest, 24) (push) Has been cancelled
Tests / conformance test (windows-latest, 24, shard 1/3) (push) Has been cancelled
Tests / conformance test (windows-latest, 24, shard 2/3) (push) Has been cancelled
Tests / conformance test (windows-latest, 24, shard 3/3) (push) Has been cancelled
Tests / Required tests (push) Has been cancelled
chore: point MSD at git.golem15.com/golem15/msd-core
The fork lives on the golem15 Gitea forge, not GitHub. Package identity now
parses either host and derives in-place raw URLs for Gitea; the identity-drift
lint accepts the new host; README drops GitHub-only badges and the npm
quickstart in favour of the checkout installer.
2026-10-06 10:41:56 +02:00
..

Dynamic context management — Option-E reference example

Reference example for ADR-1671, "Dynamic context management platform."

This is a non-shipping reference example. It lives outside the build (src/ → bin/lib/), the npm package files[], the installer, and the CI test suite (tests/). Nothing here is compiled into or installed with MSD. The production implementation lands in a later phase of the Dynamic Context Management epic (#1671).

What it demonstrates

The predicate fact-store → JIT selector slice of the platform: parse the repo-root CONTEXT.md CLASS.subkey=value predicates into structured records, drift-guard a generated index, and select the relevant predicate subset for a task — the building block for just-in-time agent-brief assembly instead of hand-citing a 200 KB file.

Files

  • context-predicates.cjs — parser + selector + deterministic index builder (self-contained).
  • gen-context-index.cjs — --check / --write drift-guarded generator + --select.
  • CONTEXT-INDEX.json — sample generated output (415 predicates, 20 classes).
  • demo.cjs — runnable usage example.

Run (from the repo root)

node examples/dynamic-context-management/demo.cjs
node examples/dynamic-context-management/gen-context-index.cjs --select PRED.k320
node examples/dynamic-context-management/gen-context-index.cjs --check

Validation

During research this slice was validated with 42 behavioral tests — predicate forms, fenced-code / prose skipping, duplicate-id detection, the selector, a deterministic index, and a fast-check property test. The production implementation has since landed, with tests/context-predicates.test.cjs and tests/context-index-sync.test.cjs as its behavioral tests under tests/, and scripts/lint-example-parser-parity.cjs (wired into npm run lint:ci) asserting this example and production agree.

Research also surfaced 3 latent duplicate predicate IDs in CONTEXT.md (RULESET.WORKFLOW_MARKDOWN.FENCES, RULESET.GEMINI.TOOLS.ask_user, RULESET.GEMINI.TEST_SENTINEL) at the time; all three have since been resolved and the current index carries 0 duplicate ids.