Setup guide
Connecting RAGRAF to AutoClaw
--agent-kind autoclaw CLI + MCP zwork 2.0.2 · Electron confirmed by session measurements · zwork 2.0.2
The agent environment of the RAGRAF author (zwork 2.0.2, Electron): the product was designed on it and the published results were measured on it. Connection runs over two independent channels — the CLI without configuration and MCP through the product interface; --agent-kind autoclaw is a real code path (telemetry attribution, extended journal mode). Everything in the guide is integration-session measurements and facts from the application code.
- 2 channels: CLI + MCP
- 24 ragraf_* tools
- 4 defects closed
- 18 corpora in the author registry
Notation in commands: <repo> — path to the local RAGRAF clone (C:\AutoClaw\RAGRAF in the author session), <account> — AutoClaw account directory, <корпус> — corpus config name. Commands and outputs are quoted as measured — including the Russian strings the product prints.
Source: the integration-session document "RAGRAF × AutoClaw: connection, mechanics, verification" — measurements of the session and facts from the application code.
Two channels: CLI and MCP
Do not mix them — what you verify depends on the channel. The CLI works always and does not depend on the application settings; MCP exposes the same operations as agent tools but requires registering the server.
| CLI channel | MCP channel | |
|---|---|---|
| How it is called | python tools/ragraf.py … through the shell tool | ragraf_* tools in the agent tool list |
| Who launches it | the agent, manually, as a command | the platform, once the server is registered |
| Depends on app settings | no | yes (the server must be registered) |
| What it provides | all 13 subcommands and 22 operations | 24 operations as tools |
| Requires --project | yes, or ensure <directory> | no: the corpus is taken from the working directory |
The key consequence
If there are no ragraf_* tools in the list, RAGRAF is not broken: the index, search, schema and graphs remain fully operational through the CLI. Session measurement: tool_search for the name ragraf returned 0 tools — the MCP channel is not active, and the project rules run through the first channel.
What is already configured
A snapshot of the author machine from the integration-session measurements — a reference for how things should look after setup.
| Element | State · where |
|---|---|
| The "RAGRAF first" rule | present · ~/.pi/agent/AGENTS.md, section 8 (~1300 lines) |
| The ragraf-core skill | present in both accounts · <account>\runtime\zwork-agent\skills\ragraf-core |
| Corpora in the registry | 18 projects · <repo>\catalog\catalog.json |
| RAGRAF CLI in the agent environment | works · python tools/ragraf.py found and responding |
| ragraf_* tools (MCP) | not connected · measured: tool_search → 0 |
AutoClaw accounts on the machine (each has its own skill tree and runtime)
%APPDATA%\AutoClaw-oversea-official\accounts\<account-1>\ (основной)
%APPDATA%\AutoClaw-oversea-official\accounts\<account-2>\The skill is deployed to both accounts — it stays visible when the account is switched. Copy freshness was confirmed by measurement: SKILL.md, reference/operations.md and reference/repair.md match the project revision by SHA-256 in both accounts.
The CLI channel: works without configuration
The primary path while MCP is not registered. Three rules.
- First step — bring the corpus up to dateThe response carries status: actual — the index is current, reindexed — just rebuilt, created — there was no corpus and one was created, not_a_project — the directory does not look like a project, error — the reason is in the reason field.First step of a task (PowerShell)
python <repo>\tools\ragraf.py ensure <каталог проекта> - Then — an operation, not reading filesstale: true means the facts must not be trusted until reindexing: the code has moved ahead. This is not a "just in case" warning.Index operations (PowerShell)
python <repo>\tools\ragraf.py -p <repo>\config\<корпус>.yaml query symbol --name corpus_hash python <repo>\tools\ragraf.py -p <repo>\config\<корпус>.yaml check - The corpus list — a command that needs no configurationThe development registry is visible without -p: catalog prints every registered corpus with revisions and checksums.Corpus registry (PowerShell)
python <repo>\tools\ragraf.py catalog
Why the CLI is preferable here
Not for convenience. Every command prints text the agent reads directly, while an MCP response must be interpreted through a schema. The CLI also depends neither on restarting the app nor on server registration — it cannot "silently fall off". Polygon measurement: 14 tool calls versus 28 without the index; first-hit on the target file — 92%.
The MCP channel: mechanics and connection
The way MCP connection works in AutoClaw differs from familiar clients (Claude Desktop, Codex, DeepSeek Harness), and that matters. Four facts measured in the session:
- There is no MCP config in the profileA search through ~/.pi, <account>\runtime and <account>\projects found neither mcp.json nor mcpServers in the settings. Registration does not live in a profile file.
- ragraf is not registered by any application packageAll 106 tables of runtime.sqlite were checked — there is no MCP-server table; mentions of ragraf-mcp in the database turned out to be past-session history, not a registration.
- The vertical pack declares MCP servers by declarationThe mcpServers field exists in the pack schema: dist\resources\vertical-packs\code\zwork-pack.json. Official packs have it empty ("mcpServers": []), and there are no user packs on disk at all (a search for zwork-pack.json outside the installation — 0 files).
- The bundled agent does not serve MCP@earendil-works/pi-coding-agent contains not a single line about MCP (dist and docs checked); every mcpServers mention found in the bundle belongs to bundled vendor SDKs (Google/Gemini) and has nothing to do with AutoClaw.
A conclusion to accept, not work around
No standard file-based way to register an MCP server in AutoClaw was found. Connection goes through the product interface — project/application settings. No invented path appears here: an instruction born of guesswork destroys trust in every other number.
How to connect and what to check
- Find the MCP section in the product settingsOpen the project (or application) settings in AutoClaw and find the section about MCP / external tools — the server is registered there.
- Enter the launch values (verified by running)--project is not needed: the server resolves the corpus from the working directory through the development registry, and for another project the corpus is selected with the ragraf_use_project tool (ragraf_catalog lists them).
- Verify, do not assumeBefore connecting, call tool_search with the query ragraf — expect 0. After registration and a restart — 24 tools. That difference is the proof the connection worked.
команда: <repo>\.venv\Scripts\python.exe
аргументы: <repo>\tools\ragraf-mcp.py
--agent AutoClaw --agent-kind autoclaw
рабочий каталог: <repo>If there is no such settings section
Then the honest answer is: the MCP channel is unavailable in this build, and RAGRAF works through the CLI (previous section). Nothing is lost except that each call is a command rather than a tool. Inventing a registration by editing the database or substituting files is not allowed: runtime.sqlite is application state, and editing it behind the product back breaks the accounting of permissions and artifacts (governed_tool_* tables).
Four compatibility defects
Connecting the second client (DeepSeek Harness) exposed defects that also concerned AutoClaw. All four are closed, each with regression protection.
- The server died on the first Russian response in a scrubbed environmentThe MCP client passes only 12 variables to the child process (APPDATA, HOMEDRIVE, HOMEPATH, LOCALAPPDATA, PATH, PROCESSOR_ARCHITECTURE, SYSTEMDRIVE, SYSTEMROOT, TEMP, USERNAME, USERPROFILE, PROGRAMFILES). Neither PYTHONUTF8 nor PYTHONIOENCODING is among them, the process locale stays cp1252 — and send() died with UnicodeEncodeError: charmap codec (src/ragraf/mcp_server.py). The AutoClaw shell sets both variables, so for AutoClaw the defect was invisible — it surfaced only on the second client. Fix: force_utf8_stdio() — the streams are forced to UTF-8 inside the server itself, not taken from the environment.
- The mandatory --project blocked multi-project workFix: --project is optional, the corpus is looked up by working directory (development registry), the ragraf_use_project tool was added. One server serves all 18 corpora of the author machine.
- The reindex command did not record the run in the registryMeasured on the RAGRAF own corpus: rev-0046 in the index, rev-0045 with the old checksum in the registry; because of that, check reindexed the corpus again, while catalog and the panel showed the past state. Fix: src/ragraf/cli.py — reindex records the run through the same shared entry point watch.record_index_run as index.
- ensure and use_project were missing from the statisticsTelemetry is attached by a wrapper around the op_* facade methods, but these two operations live in the MCP server. The usage summary did not include them — meaning there was no way to answer whether agents follow the first-step rule. Fix: Facade.record_external_call (src/ragraf/facade.py) plus a record on the server side. Measurement after the fix: ensure 1, use_project 1 in the per-agent summary.
Dependencies: why the .venv interpreter
On the author machine, RAGRAF dependencies are reachable to the PATH interpreter only through PYTHONUSERBASE (%APPDATA%\AutoClaw-oversea-official\toolchain\python\Python313\site-packages). An external client scrubs it — and python from PATH fails with "PyYAML is not installed". Measured: the project .venv is self-sufficient — with all PYTHON* variables removed it imports yaml, fastembed, sqlite_vec, tree_sitter, ijson, tiktoken. This helps AutoClaw too: the CLI in the agent shell works anyway, but the .venv stops depending on environment settings.
Skill and rules
The ragraf-core skill
The skill lives in the tree of each account:
%APPDATA%\AutoClaw-oversea-official\accounts\<account>\runtime\zwork-agent\skills\ragraf-core\
SKILL.md (вход: когда применять, порядок работы)
reference/operations.md (выбор операции и границы)
reference/repair.md (что делать, когда индекс сломан)The source is the project directory: <repo>\docs\skills\ragraf-core. Edits go into the project first, then are copied to the account service directory. Otherwise, at the next deployment the account copy "falls behind" the project and the agent works from a stale revision. There are exactly two copies — one per account; the skill is present in both.
Verified by a freshness measurement (this session): both accounts hold three files — SKILL.md 9811 bytes, reference/operations.md 7546, reference/repair.md 11271 — and the SHA-256 of each matches the project revision. The account copies have not fallen behind the source.
$src = '<repo>\docs\skills\ragraf-core'
Get-ChildItem "$env:APPDATA\AutoClaw-oversea-official\accounts" -Directory | ForEach-Object {
$dst = Join-Path $_.FullName 'runtime\zwork-agent\skills\ragraf-core'
if (Test-Path -LiteralPath $dst) {
Copy-Item -Recurse -Force "$src\*" $dst
Write-Host "обновлено: $dst"
}
}Skill validation: the file starts with ---, the name and description fields parse line by line, the size is under 256 KiB, the encoding is UTF-8 without BOM, line endings are LF, and the account copy matches the project one byte for byte.
Rules: ~/.pi/agent/AGENTS.md
This is the AutoClaw user rules file — it is picked up in any project without its own AGENTS.md, and vice versa: a project AGENTS.md is stricter. AGENTS.md files from parent directories are also picked up, up to the .git boundary.
The section that forces working through the index is section 8, "Mandatory use of RAGRAF in code development". Three places to know:
| What | Where |
|---|---|
| First step of a task | §8.2: ensure <каталог> |
| Prefer ragraf_* tools over the shell | §8.2.1 |
| Reporting: revision, checksum, file:line references | §8.7 |
About the wording
If MCP is not connected, §8.2.1 prescribes "work through the shell with the commands of §8.3 and below — this does not cancel the mandatory nature of RAGRAF, it only changes the invocation method". The rule stays executable in both configurations — which is exactly why the index works on this machine without MCP.
Verification — four levels
From narrow to broad: CLI and registry → corpus freshness → the MCP channel → telemetry. Each level is a command and the expected result from the session.
The CLI channel is alive and sees the corpora: the development registry and bringing the RAGRAF own corpus up to date.
python <repo>\tools\ragraf.py catalog
python <repo>\tools\ragraf.py ensure <repo>Expected
18 projects in the registry; status: actual and matching checksums.Freshness of a specific corpus: the current checksum versus the checksum at indexing time.
python <repo>\tools\ragraf.py -p <repo>\config\<корпус>.yaml checkExpected
"corpus checksum now" = "checksum at indexing", "changed after indexing: no".The MCP channel, once connected: tool_search returns 24 tools instead of 0 — that difference is the proof of registration. Below is an independent server check without the application: the compatibility test in a scrubbed environment (15 checks).
tool_search("ragraf") → до подключения: 0 инструментов
после регистрации и перезапуска: 24
ragraf_ensure() → status = actual | reindexed | created
ragraf_index_status() → index_rev, capability
ragraf_use_project(project="<имя>") → ревизия ДРУГОГО корпусаcd <repo>
Remove-Item Env:\PYTHONUTF8, Env:\PYTHONIOENCODING -ErrorAction SilentlyContinue
python tests\test_mcp_compat.py # 15 проверокWho called what: the per-agent summary with operations.
python <repo>\tools\ragraf.py -p <repo>\config\<корпус>.yaml usage --agent AutoClawExpected
A per-agent line with the call count and operations, including ensure. If ensure is absent from the breakdown, the client never called it — telemetry did not "lose" it.Rollback
MCP registration is the only reversible action in the interface: remove the server in the same settings section and restart the application. The index, registry and corpora are unaffected.
The RAGRAF edits themselves are additive; restoring the previous behavior takes three changes: remove the force_utf8_stdio() call, return required=True to --project, delete ragraf_use_project from TOOLS and _handlers. None of them touches the index, storage schema, revision numbering or the registry — no reindexing is needed on rollback.
The skill copies in the accounts are restored from the project:
Copy-Item -Recurse -Force <repo>\docs\skills\ragraf-core `
"$env:APPDATA\AutoClaw-oversea-official\accounts\<account>\runtime\zwork-agent\skills\ragraf-core"Where things live in AutoClaw
| What | Path |
|---|---|
| Application installation (zwork 2.0.2) | %LOCALAPPDATA%\Programs\AutoClaw2 |
| Application code (not asar) | …\resources\app\dist\main.cjs |
| Bundled agent | …\resources\app\node_modules\@earendil-works\pi-coding-agent |
| Vertical packs (incl. mcpServers) | …\app\dist\resources\vertical-packs\<pack>\zwork-pack.json |
| Product data directory | %APPDATA%\AutoClaw-oversea-official |
| Accounts | …\accounts\<sha256> |
| Agent skills | <account>\runtime\zwork-agent\skills\<имя>\SKILL.md |
| Projects | <account>\projects\<имя> |
| State (DB, permissions, artifacts) | <account>\runtime\runtime.sqlite |
| Secrets and bindings | <account>\runtime\*.enc, credentials.enc, owner-secrets.enc |
| User rules (all projects) | ~/.pi/agent/AGENTS.md |
| Project directory rules | AGENTS.md в корне проекта |
What not to read or edit
*.enc files in runtime (their content is not needed — only the name, size and the rule) and runtime.sqlite behind the product back: it holds tool permissions (governed_tool_approvals), artifacts (governed_tool_*) and channel bindings. Editing that database by hand bypasses the permission accounting — it does more than was asked.
Installation peculiarity: the application code lies unpacked (resources\app\dist), not in app.asar. That is convenient for reconnaissance: files are readable by ordinary means and main.cjs can be searched line by line.
Invitation to AutoClaw
Invite friends — no limits!
The AutoClaw Credit StormAutoClaw's official programme
With my invite code every friend who joins gets extra bonus credits on top of the welcome grant — and I get credits too: a win-win loop with no cap on the number of invites. It costs nothing, takes ten seconds, and remains the best way to support the developer who keeps this page, the setup guides and the tips coming.
- Double dip for youWelcome tokens and the invite bonus stack when you sign up with the code.
- No limitsInvite as many friends as you like — every join refills credits for both sides.
- Support the developerUsing the code is a free “thank you” that keeps the guides, configs and updates flowing.
Works on Windows, macOS and Linux. Already installed? Open AutoClaw → Settings → “Enter invite code” → paste the code. Then share your own link and keep the chain going.
This is an invitation to the AutoClaw referral programme, not a fact about RAGRAF: the code and link belong to the author's account, this page is not officially affiliated with the programme and gets no fee from the product for it.