engram-routing
Skill1 starsChanged 23 days agoMITView on GitHub
Use an approved, hash-keyed routing instinct to annotate a repeated prompt before the planner ranks skills. Use when a prompt pattern recurs and routing should reuse prior evidence.
In this repository46 other files it gives its agents.
- AGENTS.mdAGENTS.md
- .codex/AGENTS.mdAGENTS.md
- .gemini/AGENTS.mdAGENTS.md
- .cursor/rules/agent-foundry-orchestrator.mdcCursor rule
- .cursor/rules/agent-foundry-skills.mdcCursor rule
- web/llms.txtllms.txt
- anti-slopSkill
- api-designSkill
- automation-pickSkill
- bottleneck-gatingSkill
- budget-guardSkill
- cache-identitySkill
- constraint-then-solveSkill
- context-optimizationSkill
- cron-troubleshootSkill
- e2e-test-strategySkill
- execution-observabilitySkill
- fallback-model-routingSkill
- feedback-loopSkill
- judge-integritySkill
- knowledge-extractSkill
- landscape-firstSkill
- measure-firstSkill
- plan-before-codeSkill
- plan-then-actSkill
- prompt-disciplineSkill
- pushback-when-wrongSkill
- quality-protocolSkill
- read-before-buildSkill
- re-verify-findingsSkill
- session-closeoutSkill
- session-distillSkill
- show-your-workSkill
- structured-output-contractSkill
- verify-firstSkill
- workflow-decomposeSkill
- agent-memory-vaultSkill
- agent-team-standardsSkill
- autonomous-briefingSkill
- book-to-skillSkill
- chrome-devtools-mcp-bridgeSkill
- design-languageSkill
- funnel-pr-guardSkill
- persistent-memorySkill
- sql-migration-trioSkill
- token-compressionSkill
The file
We split this skill into the rules it gives an agent
2 rules. About 0 are common, 2 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 31
Look up approved instincts by their stored hashes.
- Distinctive: line 33
Prefer a project-scoped row only after it has enough samples.
≈ “Common” is an estimate: at least 1 in 5 of the 364,980 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Engram Routing
The runtime includes an Engram-style lookup over approved routing instincts. It annotates the planner result, not replaces it, and is not a hard fast path.
Procedure
What ships
agent_foundry/logging_db/: multi-head N-gram lookup, instinct storageagent_foundry/daemon.py:GET /engramand/planannotation- CLI:
learn,instincts,instinct-approve
An instinct is a trigger pattern learned from execution history. It becomes eligible only after it is approved and its confidence clears the caller's threshold.
How lookup works
- Normalize the prompt and derive ordered N-gram heads.
- Look up approved instincts by their stored hashes.
- Require at least two heads to agree, except legacy single-head rows.
- Prefer a project-scoped row only after it has enough samples.
- Return the best match with a gate score from keyword overlap.
The daemon uses a higher confidence floor for /plan annotation than for a
direct /engram query. Inspect the current constants in daemon.py rather
than assuming a value.
Inspect and approve
agent-foundry learn
agent-foundry instincts
agent-foundry instincts --approved
agent-foundry instincts --explain <id>
agent-foundry instinct-approve <id>learn analyzes the execution log and updates instinct confidence. It prints
new and updated counts plus the learned patterns.
Direct lookup:
curl "http://127.0.0.1:8765/engram?prompt=review%20the%20auth%20middleware"A hit includes the skill id, trigger pattern, confidence, sample count, scope, and gate score. A miss returns null; that is a normal cold-start result.
What /plan does with a hit
/plan still runs the planner. When an Engram hit clears the confidence and
gate-score checks, the response gains an engram_cache_hit field. Treat that
field as evidence about routing, not as a substitute for the plan.
Limits
- A hash hit alone is weak evidence; the gate score must also clear its floor.
- Unapproved instincts never route.
- New prompts usually miss. Falling back to the planner is expected.
- Lookup is an indexed database query, not a guarantee of constant-time behavior under every load.
- The table learns from completed executions; a fresh install has no history.
Anti-patterns
- Hard-routing on hash equality without the gate score.
- Approving instincts from a handful of runs.
- Treating
/engramas a complete planner. - Letting unapproved or stale patterns accumulate without review.
- Claiming a hit rate the repository has not measured.
Verification Checklist
learnruns against a populated execution log.instincts --approvedlists the pattern used for the test./engramreturns a hit for the known prompt and null for an unrelated one./planstill returns a full plan when an Engram hit exists.- The response names the matched instinct and its confidence.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

