Graphonomous
Continual learning engine for AI agents, implemented as an Elixir OTP application with a durable SQLite-backed knowledge graph, confidence-updating learning loop, GoalGraph orchestration, κ-aware topology routing, and MCP tools/resources.
v0.2.0 — Full spec compliance: 6 node types, 16 edge types, 7-stage consolidation pipeline, 22 MCP tools, 5 MCP resources. κ-aware topology routing works end-to-end — κ = 0 triggers fast retrieval, κ > 0 triggers deliberation with fault-line decomposition. 240 tests, 0 failures.
TL;DR
- Install:
npm i -g graphonomousornpx -y graphonomous- Use as an MCP server over stdio or HTTP
- κ-aware topology routing ships out of the box — no configuration needed
- 22 tools covering knowledge CRUD, retrieval, learning, goals, consolidation, and attention
- Works with Claude Code, Zed, and any MCP-compatible client
Always-On Agent Skills Wiring (Required)
To ensure Graphonomous MCP is used correctly every chat, this repo ships an always-on skills pack and bootstrap prompt.
Skills pack location
docs/skills/SKILLS.md(index)docs/skills/AGENT_BOOTSTRAP_PROMPT.md(always-on bootstrap policy)docs/skills/01_RETRIEVE_AND_REMEMBER.mddocs/skills/02_LEARNING_LOOP.mddocs/skills/03_GRAPH_INSPECTION.mddocs/skills/04_GOAL_MANAGEMENT.mddocs/skills/05_COVERAGE_AND_REVIEW.mddocs/skills/06_TOPOLOGY_AND_DELIBERATION.mddocs/skills/07_CONSOLIDATION.mddocs/skills/08_ATTENTION.mddocs/skills/09_WORKFLOWS.mddocs/skills/10_ANTI_PATTERNS.md
Prompt injection guidance (system/developer context)
When configuring any agent/chat runtime, inject:
docs/skills/AGENT_BOOTSTRAP_PROMPT.md(required)docs/skills/SKILLS.md(required)- Relevant numbered skill files (or all files for general-purpose sessions)
Minimum acceptable wiring: bootstrap prompt + skills index.
Repository wiring status
This repository already wires these policies into:
AGENTS.mdCLAUDE.md
That means local repo-aware agent sessions should default to a Graphonomous-first loop: retrieve → reason/act → store → learn_from_outcome → consolidate.
For Users (npm-first)
1) Install and run
Use whichever fits your workflow.
Option A — One-off run with npx (no global install)
npx -y graphonomous --help
npx -y graphonomous --db ~/.graphonomous/knowledge.db --embedder-backend fallback
npx -y graphonomous scan ./docs --extensions .md,.txt
npx -y graphonomous watch ./docs --poll-interval-ms 1500 --ingest-on-start
Option B — Global install
npm i -g graphonomous
graphonomous --help
graphonomous --db ~/.graphonomous/knowledge.db --embedder-backend fallback
graphonomous scan ./docs --extensions .md,.txt
graphonomous watch ./docs --poll-interval-ms 1500 --ingest-on-start
2) First-time setup (2–5 minutes)
- Create a data directory:
mkdir -p ~/.graphonomous
- Run Graphonomous:
npx -y graphonomous --db ~/.graphonomous/knowledge.db --embedder-backend fallback
- Configure your MCP client to launch
graphonomous(ornpx) and pass the same args.
3) Zed setup (custom context server)
In Zed settings JSON, use either installed command, npx, or a local wrapper script (recommended for dev logging/debugging).
Installed command
{
"context_servers": {
"graphonomous": {
"command": "graphonomous",
"args": ["--db", "./.graphonomous/knowledge.db", "--embedder-backend", "fallback"],
"env": {
"GRAPHONOMOUS_EMBEDDING_MODEL": "sentence-transformers/all-MiniLM-L6-v2"
}
}
}
}
npx command
{
"context_servers": {
"graphonomous": {
"command": "npx",
"args": ["-y", "graphonomous", "--db", "./.graphonomous/knowledge.db", "--embedder-backend", "fallback"],
"env": {}
}
}
}
Local wrapper script (recommended for local dev + logs)
Use a wrapper that launches local source via mix run and writes stderr logs to ~/.graphonomous/logs.
{
"context_servers": {
"graphonomous": {
"command": "/home/travis/ProjectAmp2/graphonomous/scripts/graphonomous_mcp_wrapper.sh",
"args": [],
"env": {}
}
}
}
After saving:
- Open Zed Agent panel.
- Confirm server is active.
- Ask explicitly for Graphonomous tool usage (for example: “use
graphonomousto retrieve context for …”).
3b) Claude Code setup
Add to your project's .mcp.json:
{
“mcpServers”: {
“graphonomous”: {
“command”: “npx”,
“args”: [“-y”, “graphonomous”, “--db”, “./.graphonomous/knowledge.db”, “--embedder-backend”, “fallback”]
}
}
}
Or if installed globally:
{
“mcpServers”: {
“graphonomous”: {
“command”: “graphonomous”,
“args”: [“--db”, “./.graphonomous/knowledge.db”, “--embedder-backend”, “fallback”]
}
}
}
4) Zed timeout troubleshooting
If Zed shows context server request timeout:
- Confirm CLI works first:
graphonomous --version
graphonomous --help
- Start with fallback embedder and a longer request timeout:
graphonomous --db ~/.graphonomous/knowledge.db --embedder-backend fallback --request-timeout 180000
- Prefer local wrapper-script mode for debugging to capture server stderr logs:
{
"context_servers": {
"graphonomous": {
"command": "/home/travis/ProjectAmp2/graphonomous/scripts/graphonomous_mcp_wrapper.sh",
"args": [],
"env": {}
}
}
}
- After reproducing once, inspect wrapper logs:
ls -lt ~/.graphonomous/logs | head
LATEST="$(ls -1t ~/.graphonomous/logs/zed-mcp-*.log | head -n1)"
tail -n 200 "$LATEST"
- Fully restart Zed after changing MCP config.
- Reinstall/upgrade your global package if needed:
npm uninstall -g graphonomous
npm i -g graphonomous
5) MCP tools (22 total)
Knowledge graph write:
store_node,store_edge,delete_node,manage_edge
Knowledge graph read/query:
retrieve_context— κ-aware ranked retrieval with topology annotationsquery_graph— operation-based graph inspectiontopology_analyze— SCC/κ analysis with routing recommendationgraph_traverse— BFS walk with depth/relationship filtersgraph_stats— aggregate counts, distributions, confidence stats, orphan detection
Specialized retrieval:
retrieve_episodic— time-range filtered episodic nodesretrieve_procedural— semantic search scoped to procedural nodescoverage_query— standalone epistemic coverage (act/learn/escalate)
Learning loop:
learn_from_outcome— causal confidence updateslearn_from_feedback— positive/negative/correction feedbacklearn_detect_novelty— similarity-based novelty scoringlearn_from_interaction— full pipeline (novelty → store → extract → link)deliberate— κ-driven deliberation over cyclic regions
Goal orchestration:
manage_goal,review_goal
Maintenance & autonomy:
run_consolidation,attention_survey,attention_run_cycle
MCP resources (5 read-only)
graphonomous://runtime/health— runtime health + service statusgraphonomous://goals/snapshot— goal totals, status breakdowngraphonomous://graph/node/{id}— individual node details + edgesgraphonomous://graph/recent— recently accessed/modified nodesgraphonomous://consolidation/log— consolidator state + orchestrator plasticity metrics
6) Recommended laptop setting
Use:
--embedder-backend fallback
This avoids heavyweight backend friction and is the quickest reliable starting point on constrained machines.
7) Common CLI flags
Command modes:
graphonomous(start MCP server over stdio)graphonomous --transport streamable_http --port 4100(start MCP server over HTTP)graphonomous scan <directory>(one-shot traversal from scratch)graphonomous watch <directory>(continuous change detection + traversal)
Global options:
--db PATH-v, --version--embedding-model MODEL--embedder-backend auto|fallback--sqlite-vec-extension-path PATH--consolidator-interval-ms MS--consolidator-decay-rate FLOAT--consolidator-prune-threshold FLOAT--consolidator-merge-similarity FLOAT--learning-rate FLOAT--log-level debug|info|warning|error--request-timeout MS
Filesystem traversal options (scan / watch):
--recursive--include-hidden--follow-symlinks--extensions .ex,.md,.txt--poll-interval-ms MS--ingest-on-start--max-file-size-bytes N--max-read-bytes N
Help:
graphonomous --version
graphonomous --help
8) Runtime environment variables
GRAPHONOMOUS_DB_PATH(default:priv/graphonomous.db)GRAPHONOMOUS_EMBEDDING_MODEL(default:sentence-transformers/all-MiniLM-L6-v2)GRAPHONOMOUS_EMBEDDER_BACKEND(auto | fallback)GRAPHONOMOUS_SQLITE_VEC_EXTENSION_PATH(optional)GRAPHONOMOUS_CONSOLIDATOR_INTERVAL_MSGRAPHONOMOUS_CONSOLIDATOR_DECAY_RATEGRAPHONOMOUS_CONSOLIDATOR_PRUNE_THRESHOLDGRAPHONOMOUS_CONSOLIDATOR_MERGE_SIMILARITYGRAPHONOMOUS_LEARNING_RATELOG_LEVEL(debug | info | warning | error)
Example:
export GRAPHONOMOUS_DB_PATH="$HOME/.graphonomous/knowledge.db"
export GRAPHONOMOUS_EMBEDDER_BACKEND="fallback"
export LOG_LEVEL="info"
For Maintainers
Local development verification
MIX_ENV=test mix deps.get
MIX_ENV=test mix format --check-formatted
MIX_ENV=test mix compile --warnings-as-errors
MIX_ENV=test mix test --color
Source fallback run (no npm)
cd ProjectAmp2/graphonomous
mix deps.get
mix compile --warnings-as-errors
mix test
MIX_ENV=prod mix release --overwrite
_build/prod/rel/graphonomous/bin/graphonomous eval "Graphonomous.CLI.main(System.argv())" --help
npm package pre-publish smoke test
cd ProjectAmp2/graphonomous/npm
npm pack
mkdir -p /tmp/graphonomous-npm-smoke && cd /tmp/graphonomous-npm-smoke
npm init -y
npm i /home/travis/ProjectAmp2/graphonomous/npm/graphonomous-0.2.0.tgz
npx graphonomous --help
Release + publish flow (high level, manual-first)
- Ensure versions align (
mix.exs,npm/package.json, git tagvX.Y.Z). - Build release assets locally and upload them to GitHub Release
vX.Y.Z. - Run
npm publishlocally fromProjectAmp2/graphonomous/npm. - Verify with
npm view graphonomous versionandnpx -y graphonomous --help.
See full operational runbook:
docs/NPM_PUBLISH.md(manual publish path; no CI token dependency required)
Architecture snapshot
Supervised services:
Graphonomous.StoreGraphonomous.EmbedderGraphonomous.GraphGraphonomous.RetrieverGraphonomous.Orchestrator— stability-plasticity monitoring, adaptive learning ratesGraphonomous.LearnerGraphonomous.GoalGraphGraphonomous.Consolidator
Storage:
- SQLite tables:
nodes,edges,outcomes,goals - migration tracking:
schema_migrations - ETS hot cache with startup rebuild
Public API (direct module usage)
Primary module: Graphonomous
- Node graph:
store_node/1,get_node/1,list_nodes/1,update_node/2,delete_node/1,link_nodes/3,query_graph/1 - Retrieval + learning:
retrieve_context/2,learn_from_outcome/1 - GoalGraph:
create_goal/1,get_goal/1,list_goals/1,update_goal/2,delete_goal/1,transition_goal/3,link_goal_nodes/2,unlink_goal_nodes/2,set_goal_progress/2,review_goal/3 - Coverage + ops:
evaluate_coverage/2,decide_coverage/2,run_consolidation_now/0,rebuild_cache/0,consolidator_info/0,health/0 - Orchestrator:
orchestrator_info/0,current_learning_rate/0,recommend_timescale/1
Documentation map
docs/BOOTSTRAP.md— bootstrap + verificationdocs/ZED.md— Zed integration detailsdocs/NPM_PUBLISH.md— npm publishing and maintenance runbookdocs/skills/— always-on Graphonomous agent skills pack and bootstrap promptnpm/README.md— npm wrapper package usage and overrides
Notes
- EXLA is currently optional to avoid environment-level NIF/CUDA mismatch issues.
- sqlite-vec extension loading is optional.
- OpenSentience integration is not required to start using Graphonomous.
- MCP stdio reliability is currently ensured by a vendored
anubis_mcpdependency patch (vendor/anubis_mcp) that fixes decoded message list handling and request-response writes in the STDIO transport path.
License
Apache-2.0