{
  "markdown": "# magi-knowledge\n\nOKF v0.2 knowledge bundle for the MAGI trading system. A directory of markdown\nfiles with YAML frontmatter — readable by humans, parseable by agents, diffable\nin git, with **no required tooling** to consume.\n\n```\nmagi-knowledge/\n├── index.md                 # bundle root (declares okf_version)\n├── log.md                   # change history\n├── _lilith_safe/            # LILITH-training-consumable ground truth (guarded)\n│   ├── schemas/             #   prompt-block schemas (structure, not values)\n│   ├── hallucination-patterns/\n│   └── constitution/        #   clean-source rule, output envelope, risk rules\n├── system/                  # full-system knowledge — NEVER fed to LILITH\n│   ├── echidna-tables/      #   BigQuery (magi_core dataset) data catalog\n│   ├── plm-units/           #   the MAGI LLM units / PLM roster (cross-unit registry)\n│   ├── services/            #   cross-repo service dependency map\n│   └── guards/              #   L1–L7 guard layer reference\n└── scripts/\n    ├── okf_common.py        # zero-dep frontmatter parser + trust-tier helpers\n    ├── okf_lint.py          # OKF conformance, trust/lifecycle + LILITH contamination linter\n    ├── okf_export.py        # flatten one tree into a single Markdown digest\n    ├── lilith_safe_loader.py# the ONLY sanctioned reader for LILITH training\n    └── test_lilith_safe_loader.py\n```\n\n## Development agents\n\nStart with [AGENTS.md](AGENTS.md) and the shared\n[collaboration workflow](COLLABORATION.md) for GPT/Codex, Devin and Antigravity.\nThe workflow covers task ownership, handoffs, independent review and extending\nexisting drift checks.\n\n## Why this exists\n\nMAGI knowledge was scattered across code comments, `magi-stg/specifications`,\nDevin knowledge notes, and per-repo READMEs. This bundle consolidates the parts\nthat multiple agents need to agree on — BigQuery schemas, the PLM unit roster,\nand the ground-truth definitions the LILITH training pipeline depends on — into\none diffable, agent-readable corpus.\n\n## The LILITH contamination boundary (read this first)\n\nLILITH is an **independent reasoner**: per the MAGI Constitution it must decide\nonly from its own verifiable data, never from another unit's processed\nintelligence, and never from Section 5 (\"Jun Review Only\") ticker picks.\n\nTo make that boundary impossible to cross by accident:\n\n| Mechanism | Guarantee |\n|---|---|\n| `_lilith_safe/` subtree | The only knowledge the training pipeline may read. |\n| `lilith_safe: true\\|false` frontmatter | Must match the doc's location; CI fails otherwise. |\n| `scripts/lilith_safe_loader.py` | Reads only `_lilith_safe/`; refuses traversal & unflagged docs (fail-loud). |\n| `scripts/okf_lint.py` | Fails CI on cross-unit names, unit win-rates, or Section 5 / ticker picks inside `_lilith_safe/`. |\n\n## Trust & lifecycle (what is canonical?)\n\nEvery concept carries OKF v0.2 trust frontmatter, enforced by `okf_lint.py`:\n\n```yaml\nstatus: stable                                          # draft | stable | deprecated\ngenerated: { by: devin/cloud, at: 2026-08-27T07:28:31Z } # who wrote it (§7 actor)\nverified: { by: human:jun, at: 2026-08-27T07:28:31Z }    # who confirmed it\nstale_after: 2027-02-23T07:28:31Z                        # re-verify by this instant\n```\n\n`stable` requires a `human:` verifier; AI-authored, AI-reviewed content stays\n`draft`. Linking to a `deprecated` doc from a live one fails CI. Stale docs\nwarn on every PR and fail the weekly freshness run (`okf_lint.py --fail-on-stale`).\nSee [index.md](index.md#knowledge-authority-trust--lifecycle) for the rationale.\n\n## Consuming the bundle\n\nNo SDK required — `cat` any file. Agents parse the frontmatter directly.\n\n### Syncing the spec to an LLM that cannot read the repo\n\nAgents with repository access (Antigravity, Devin, Devin CLI) should read this\nbundle directly — clone/pull `main`, or vendor it as a submodule. For chat UIs\nand one-shot prompts, flatten a tree into a single pasteable file:\n\n```bash\npython scripts/okf_export.py                      # system/ tree (~90 KB)\npython scripts/okf_export.py --tree _lilith_safe  # LILITH-safe tree only\npython scripts/okf_export.py -o /tmp/magi-spec.md\n```\n\nOne run exports exactly one tree, and a doc whose `lilith_safe` flag disagrees\nwith its tree aborts the export — the digest can never mix the two sides of the\ncontamination boundary. Output goes to stdout by default, so no generated copy\nis committed: regenerate instead of editing a digest.\n\nThe LILITH training pipeline (`dogmaai/lilith-training`) vendors this bundle\n(git submodule at `vendor/magi-knowledge`, or a build-time fetch) and reads it\n**only** through `LilithSafeKnowledge`:\n\n```python\nfrom lilith_safe_loader import LilithSafeKnowledge\nkb = LilithSafeKnowledge(\"vendor/magi-knowledge\")\nschema   = kb.get(\"schemas/isabel-stats-block\")\npatterns = kb.hallucination_patterns()\nforbidden_names = kb.cross_unit_names()   # detector list, never prompt text\n```\n\n## CI\n\n`.github/workflows/okf-conformance.yml` runs the linter and the loader smoke\ntest on every PR. Both are pure-stdlib Python 3.11 (no pip install).\n\nRun locally:\n\n```bash\npython scripts/okf_lint.py\npython scripts/test_lilith_safe_loader.py\n```\n",
  "bytes": 5197,
  "sha": "a38334f874cdeeae6b7a4443599160e9e3b40e68b50da54ef61a7357668d8da9",
  "repo_slug": "dogmaai/magi-knowledge",
  "fonte": "repo",
  "truncated": false,
  "api": "https://agentalog.com/api/listings/okf_dogmaai_magi_knowledge_index_md_ed6c8580/readme"
}