Arth docs

Memory and routing

Tested on Arth Sarathi 1.0.2 (commit eaede405) with Claude Code 2.1.154 or later, on 2026-12-01.

What this page covers: what /calibrate writes about your project, how the knowledge graph is built and read, how prompts and models are routed, and how to view, edit or reset each part. Time: about 5 minutes to read.

Memory and routing are built into Arth Sarathi, so there is nothing to install or turn on. Memory is a set of plain files in your project, and routing is two prompt hooks plus one policy file. Neither runs a database or a server, and neither opens a port. The one exception is the optional model router, described in local models and a second provider.

A shared memory server and a hosted routing service for teams are part of the separate team edition. They are not in this repository, and nothing on this page needs them.

#The order to run things

  1. /arth-setup once per machine. Its last step offers /calibrate.
  2. /calibrate once per project, before the work skills.
  3. The work skills. For a feature: /planning csv-export -- let users download their orders as CSV, then /implementation-plan csv-export, then /implement csv-export (it needs the plan /implementation-plan writes). For a bug: /fix "the login page returns 500 when the email has a plus sign". Before you merge: /qa, then /pr.

If .claude/project-profile.md does not exist yet, /planning, /implement and /fix print one line, Tip: run /calibrate first so this skill knows your project's conventions., and carry on.

#What /calibrate writes

/calibrate scans your code with a few agents, then shows what it found and what it recommends. It asks before it installs anything, with three answers: Install all, Pick items or Skip.

It always writes .claude/project-profile.md: the architecture, coding conventions, domain model and testing style it found.

Unless you pick Skip, it also writes the knowledge base in .claude/knowledge/:

PathWhat is in it
shared/conventions.mdCoding rules for this project
shared/domain.mdBusiness rules that the code does not make obvious
shared/patterns.mdHow the code is structured, so new code can follow it
shared/vocabulary.mdWhat the project calls things
shared/decisions.mdChoices the team made and the reasons for them
shared/best-practices.mdPractices taken from your code, or common ones for your stack when the code is small
agents/Notes each agent writes as it learns, created the first time an agent writes one
external/sources.mdWhere knowledge lives outside the code
meta/Hashes of key project files and simple stats, used to spot when the project has changed since the last run
graph/graph.jsonlThe knowledge graph, built from the shared/ files (next section)

Other ways to run it:

At the start of a session, if a key project file such as package.json or pyproject.toml changed since the last calibration, the briefing says so and suggests /calibrate rescan.

#The knowledge graph

The graph is an index of the shared/ markdown files, so a skill can pull the few entries that match a task instead of reading every file.

#How it is built

The kg-ingest.sh script reads each .claude/knowledge/shared/*.md file and makes one node per ### heading. A node holds the heading, the text under it, keywords taken from that text, a type and a weight. The type comes from the file name: patterns.md gives patterns, domain.md domain rules, decisions.md decisions, vocabulary.md vocabulary, and the other files conventions. It writes all nodes to .claude/knowledge/graph/graph.jsonl: one header line, then one JSON object per node. The same input always gives the same file.

#When it is built or refreshed

#How skills read it

/fix, /planning, /implement, /qa, /pr, /review-pr, /ci-fix and several others run kg-query.sh with keywords from the task. It ranks nodes by keyword overlap and weight and returns the best few. If the graph is missing or older than the markdown, the skill skips it. Either way the skill still reads the markdown files directly, so the graph adds context and never replaces it.

#How skills add to it

When a skill learns something, it can call kg-write.sh, which adds a node to the graph or, if the same node is already there, raises its weight. /fix, for example, writes what a bug taught it both to a shared/ file and to the graph, and keeps incident notes in .claude/qa-knowledge/.

#Session notes

When a session ends, a hook writes a short note to last-session.md in Claude Code's own memory folder for the project, under ~/.claude/projects/. It holds the branch, the last commit, uncommitted files, open tasks and the last few assistant messages. It is a plain markdown file that the hook rewrites at the end of each session.

#View, edit and reset

Everything above is a file you can open in any editor.

#Prompt routing

Two hooks read every prompt you type. Both are shell scripts that run on your machine and exit. Neither makes a network call unless you set it up to; what runs on your machine lists the exceptions.

Two skills go with them:

#Model choice per agent

model-policy.yml, which ships with the plugin, sets the Claude model tier for each agent: opus, sonnet, haiku, or inherit (use the same model as the skill that started it). An entry can also set a reasoning effort and a fallback tier, used if a model is retired. Skills read this file before they start agents. If the file is missing, they use the tiers written in each skill.

#Local models and a second provider

By default every model call goes to Claude. The /arth-setup question Where should AI models run? can change that:

For the last two, setup checks that the model answers, including a tool call, through the model router before it points Claude Code at it. The model router is a local process on 127.0.0.1:4000. It passes Claude requests to Anthropic unchanged and sends the execution agents' requests to the model you chose. Claude keeps planning and review. After you confirm, setup adds two keys, ANTHROPIC_BASE_URL and ANTHROPIC_DEFAULT_SONNET_MODEL, to .claude/settings.local.json in that project, writes a model-policy.override.yml, and keeps the router's files in ~/.arthai/proxy/. If the router is down when a session starts, the session-start hook starts it again; set ARTH_PROXY_AUTOSTART=0 to stop that.

To go back to Claude only, run /arth-setup switch off models. It removes the settings keys it added, stops the router and deletes the override and router config. It does not touch your keys.