Back to the catalog

MAGI Knowledge Bundle

Bundle OKF 0.2 · 2 conceitos · dogmaai/magi-knowledge

Open source Repository Open in the app JSON README (API)

About

# MAGI Knowledge Bundle

Single source of truth for MAGI system knowledge, expressed in the
[Open Knowledge Format](https://github.com/GoogleCloudPlatform/knowledge-catalog/blob/main/okf/SPEC.md)
(OKF v0.2). Authored for both humans and the AI agents that operate MAGI
(Devin, AKA-1, ARIEL) and for the LILITH training pipeline.

The previous specification lived in `dogmaai/magi-stg` (`specifications/` and
`docs/`); that repository is **archived** and its spec files carry a banner
pointing here. This bundle is now the only authoritative source. See
[log.md](log.md) for the change history.

# Trees

* [_lilith_safe/](_lilith_safe/) - Clean-source ground truth the LILITH training pipeline MAY consume. Contamination-guarded.
* [system/](system/) - Full-system knowledge (ECHIDNA tables, PLM unit registry, services, guard layers). MUST NOT flow into LILITH.

# The LILITH contamination boundary

LILITH (the fine-tuned Qwen2.5-3B reasoner) must reason **only** from its own
verifiable data and n

Details

Kind
OKF bundles
Topic
AI, RAG & memory
Publisher
dogmaai
Origin
okf_github
Category
dados
Version
0.2
Stars
1
Last push
2026-09-09T07:35:39Z
Repository state
ativo
Language
Python
License
MIT
Added
2026-09-09 12:02:17
Updated
2026-09-09 12:02:17
Origin id
dogmaai/magi-knowledge:index.md

README

# magi-knowledge

OKF v0.2 knowledge bundle for the MAGI trading system. A directory of markdown
files with YAML frontmatter — readable by humans, parseable by agents, diffable
in git, with **no required tooling** to consume.

```
magi-knowledge/
├── index.md                 # bundle root (declares okf_version)
├── log.md                   # change history
├── _lilith_safe/            # LILITH-training-consumable ground truth (guarded)
│   ├── schemas/             #   prompt-block schemas (structure, not values)
│   ├── hallucination-patterns/
│   └── constitution/        #   clean-source rule, output envelope, risk rules
├── system/                  # full-system knowledge — NEVER fed to LILITH
│   ├── echidna-tables/      #   BigQuery (magi_core dataset) data catalog
│   ├── plm-units/           #   the MAGI LLM units / PLM roster (cross-unit registry)
│   ├── services/            #   cross-repo service dependency map
│   └── guards/              #   L1–L7 guard layer reference
└── scripts/
    ├── okf_common.py        # zero-dep frontmatter parser + trust-tier helpers
    ├── okf_lint.py          # OKF conformance, trust/lifecycle + LILITH contamination linter
    ├── okf_export.py        # flatten one tree into a single Markdown digest
    ├── lilith_safe_loader.py# the ONLY sanctioned reader for LILITH training
    └── test_lilith_safe_loader.py
```

## Development agents

Start with [AGENTS.md](AGENTS.md) and the shared
[collaboration workflow](COLLABORATION.md) for GPT/Codex, Devin and Antigravity.
The workflow covers task ownership, handoffs, independent review and extending
existing drift checks.

## Why this exists

MAGI knowledge was scattered across code comments, `magi-stg/specifications`,
Devin knowledge notes, and per-repo READMEs. This bundle consolidates the parts
that multiple agents need to agree on — BigQuery schemas, the PLM unit roster,
and the ground-truth definitions the LILITH training pipeline depends on — into
one diffable, agent-readable corpus.

## The LILITH contamination boundary (read this first)

LILITH is an **independent reasoner**: per the MAGI Constitution it must decide
only from its own verifiable data, never from another unit's processed
intelligence, and never from Section 5 ("Jun Review Only") ticker picks.

To make that boundary impossible to cross by accident:

| Mechanism | Guarantee |
|---|---|
| `_lilith_safe/` subtree | The only knowledge the training pipeline may read. |
| `lilith_safe: true\|false` frontmatter | Must match the doc's location; CI fails otherwise. |
| `scripts/lilith_safe_loader.py` | Reads only `_lilith_safe/`; refuses traversal & unflagged docs (fail-loud). |
| `scripts/okf_lint.py` | Fails CI on cross-unit names, unit win-rates, or Section 5 / ticker picks inside `_lilith_safe/`. |

## Trust & lifecycle (what is canonical?)

Every concept carries OKF v0.2 trust frontmatter, enforced by `okf_lint.py`:

```yaml
status: stable                                          # draft | stable | deprecated
generated: { by: devin/cloud, at: 2026-08-27T07:28:31Z } # who wrote it (§7 actor)
verified: { by: human:jun, at: 2026-08-27T07:28:31Z }    # who confirmed it
stale_after: 2027-02-23T07:28:31Z                        # re-verify by this instant
```

`stable` requires a `human:` verifier; AI-authored, AI-reviewed content stays
`draft`. Linking to a `deprecated` doc from a live one fails CI. Stale docs
warn on every PR and fail the weekly freshness run (`okf_lint.py --fail-on-stale`).
See [index.md](index.md#knowledge-authority-trust--lifecycle) for the rationale.

## Consuming the bundle

No SDK required — `cat` any file. Agents parse the frontmatter directly.

### Syncing the spec to an LLM that cannot read the repo

Agents with repository access (Antigravity, Devin, Devin CLI) should read this
bundle directly — clone/pull `main`, or vendor it as a submodule. For chat UIs
and one-shot prompts, flatten a tree into a single pasteable file:

```bash
python scripts/okf_export.py                      # system/ tree (~90 KB)
python scripts/okf_export.py --tree _lilith_safe  # LILITH-safe tree only
python scripts/okf_export.py -o /tmp/magi-spec.md
```

One run exports exactly one tree, and a doc whose `lilith_safe` flag disagrees
with its tree aborts the export — the digest can never mix the two sides of the
contamination boundary. Output goes to stdout by default, so no generated copy
is committed: regenerate instead of editing a digest.

The LILITH training pipeline (`dogmaai/lilith-training`) vendors this bundle
(git submodule at `vendor/magi-knowledge`, or a build-time fetch) and reads it
**only** through `LilithSafeKnowledge`:

```python
from lilith_safe_loader import LilithSafeKnowledge
kb = LilithSafeKnowledge("vendor/magi-knowledge")
schema   = kb.get("schemas/isabel-stats-block")
patterns = kb.hallucination_patterns()
forbidden_names = kb.cross_unit_names()   # detector list, never prompt text
```

## CI

`.github/workflows/okf-conformance.yml` runs the linter and the loader smoke
test on every PR. Both are pure-stdlib Python 3.11 (no pip install).

Run locally:

```bash
python scripts/okf_lint.py
python scripts/test_lilith_safe_loader.py
```

More