Skip to content

Routing Schema — routing.md Convention

Each Commander folder (and each Captain folder where relevant) may declare a routing.md that lets Canary route inbox files to the right destination WITHOUT a Hinata interview.

Where it lives

  • federation/colonel_{pillar}_{commander}_routing.md (or inline in federation/colonel_{pillar}_{commander}_context.md)
  • federation/captain_{captain}_routing.md (or inline in federation/captain_{captain}_context.md)
  • Black Panther was the first seed (2026-05-26, originally at colonel/goku-fire/black-panther-fashion/routing.md — now at federation/colonel_goku-fire_black-panther-fashion_context.md).

File shape

markdown
---
commander: <slug>                   # e.g. allmight-health, zoro-fitness, canary-organiser
schema_version: 0.1
last_updated: YYYY-MM-DD
---

# <Commander Name> — Routing Rules

## Rules

### <human-readable rule name>

- **patterns** (any of, case-insensitive):
  - keyword: `<exact-word>` | regex: `<pattern>` | filename: `<glob>` | content: `<phrase>`
- **destination:** `federation/colonel_...` or `federation/captain_...` or `the-government/...`
- **transformation:** one of
  - `none` — drop file as-is into destination
  - `append-to-topic-file: <filename>` — prepend to canonical file (per knowledge-base ordering)
  - `extract-frontmatter` — parse YAML, then route
  - `transcribe-then-route` — for audio (Whisper / Otter)
  - `extract-csv-row` — parse one row of CSV per inbox file
- **confidence:** `high` | `medium` | `low`
  - high = ROUTE without interview
  - medium = interview with this rule's destination pre-filled as default
  - low = standard interview, ignore this rule
- **negative carve-out:** (optional) conditions that DROP the rule to medium or skip it
- **negative test:** (recommended) one example that must NOT match
- **originating evidence:** (optional) inbox slug / task # / memory reference

Field meanings

FieldNotes
patternsMatch types: keyword, regex, filename, content, phrase. Combine via AND / OR in plain prose if needed.
destinationAbsolute-from-vault path. No trailing slash if pointing at a directory; trailing .md if appending to a specific file.
transformationTells Canary what shape the file must be in when it lands. Drives any pre-processing step (e.g. transcribe-then-route invokes Otter/Whisper first).
confidenceThe gate against interview. Only high skips Hinata.
negative carve-outPer-rule conditions that downgrade or skip — prevents over-matching.
negative testA counter-example to ensure rule isn't too broad. Canary verifies this against the inbox sweep on every seed change.

Canary's load order (informational — actual wiring lands via #840008)

  1. Phase 1 (file survey): enumerate every routing rule in federation/ context files.
  2. Build in-memory ruleset keyed by patterns.
  3. For each inbox file: try ruleset BEFORE interview.
    • high-confidence match → ROUTE directly
    • medium → interview with destination pre-filled
    • low / none → standard interview path
  4. Log routing decisions to the day's the-government/information_reference/canary-processing/inbox-run-YYYY-MM-DD.md.

Stop conditions on rule authoring

  • Never widen patterns to catch generic words like decision, update, note — these cannibalise other Commanders' inboxes.
  • Never assign confidence: high without a written negative test (catches false-positive scope creep).
  • Never route to a path that doesn't exist; if the destination is new, create it first.
  • Disambiguation between Commanders is the rule author's responsibility (see Black Panther's tattoo carve-out for an example of resolving Lelouch/Black Panther overlap).

Closure (per #840007)

  • ≥5 routing.md files seeded (Black Panther already shipped 2026-05-26).
  • Schema doc exists (this file).
  • task-audit Phase 1 reading routing.md is #840008 — separate task.

Existing seeds

  • federation/colonel_goku-fire_black-panther-fashion_context.md — tattoo/piercing/aesthetic body decisions
  • federation/colonel_saitama-foundation_allmight-health_context.md — Zoot quit-smoking pings
  • federation/colonel_saitama-foundation_zoro-fitness_context.md — Workouts CSV
  • federation/captain_canary-organiser_context.md — Telegram-from-Minato ambient ops
  • federation/colonel_levi-ackerman-forge_squidward-music_context.md — Otter voice notes (music practice)