Share a folder with live two-way sync over habilis-network.
agent-knowledge share <folder> # prints a hash
agent-knowledge mount <hash> <target> # keeps <target> in sync with <folder>
agent-knowledge plug # installs the skills into Claude Code, Codex, and Pi
agent-knowledge status # prints this session's memory bank folder| Skill | What it does |
|---|---|
/knowledge-share <folder> |
Runs share in the background and prints the hash. |
/knowledge-mount <hash> <target> |
Runs mount in the background. The target is the memory bank. |
/knowledge-write <what> |
Writes an OKF concept to the session's memory bank. Errors if there is none. |
/knowledge-read [question] |
Answers from the session's memory bank. Errors if there is none. |
Each agent session runs at most one memory: one share or one mount. A
second one in the same session fails with this session already runs a ... memory. status prints the folder of the running one, and
/knowledge-write and /knowledge-read use it.
The session is $CLAUDE_CODE_SESSION_ID in Claude Code, $CODEX_THREAD_ID in
Codex, or $AGENT_KNOWLEDGE_SESSION. Without any of them (Pi, a plain
terminal), everything shares the session default. Each session's memory is
recorded in ~/.agent-knowledge/sessions/<session>.json (or under
$AGENT_KNOWLEDGE_HOME); an entry whose process died is ignored.
The table uses the Claude Code form. In Codex, a skill command starts with $
($knowledge-share). In Pi, it starts with /skill: (/skill:knowledge-share).
plug writes the 4 skills into each agent that it finds on this machine, and
replaces older copies:
| Agent | Skills folder | Override | Skill command |
|---|---|---|---|
| Claude Code | ~/.claude/skills |
$CLAUDE_CONFIG_DIR/skills |
/knowledge-share |
| Codex | ~/.codex/skills |
$CODEX_HOME/skills |
$knowledge-share |
| Pi | ~/.pi/agent/skills |
$PI_CODING_AGENT_DIR/skills |
/skill:knowledge-share |
plug finds an agent by its config folder (for example ~/.pi/agent). To
pick agents, use --agent claude-code, --agent codex, or --agent pi, one
or more times. Restart the agent to load the skills.
The skills call agent-knowledge from PATH, so install the binary before
you plug the skills:
# From a clone
cargo install --path .
# Without a clone
cargo install --git https://github.com/caiogondim/agent-knowledge
# Then plug the skills and restart Claude Code, Codex, or Pi
agent-knowledge plugcargo install puts the binary in ~/.cargo/bin. If the shell cannot find
agent-knowledge, run source ~/.cargo/env or open a new terminal.
- Rust 1.95.0.
rust-toolchain.tomlpins this version, sorustupinstalls it on the first build. - Read access to the
agent-habilis/habilis-networkGitHub repo. Cargo fetches it as a git dependency.
cargo buildCaution: the sync goes both ways. An edit or a delete in <path> also changes <folder>.
-
In terminal 1, share a folder. The command prints the hash on stdout:
cargo run -- share <folder>
-
In terminal 2, mount the hash. If
<path>does not exist, the command creates it:cargo run -- mount <hash> <path>
-
Edit, create, or delete a file on one side. The change appears on the other side in a few seconds.
-
To stop a side, press Ctrl-C.
cargo test
cargo clippysrc/scan.rshas the unit tests.tests/memory.rschecks the session id, the registry, and the one-memory rule.tests/plug.rschecks the embedded skills, the skills folder and the detection of each agent, and the install.tests/two_way.rsruns ashareloop and amountloop in 1 process. It checks a create, an edit, and a delete in both directions. It takes about 10s.
src/main.rs: the CLI, with theshare,mount, andplugcommands.src/memory.rs: the one-memory-per-session registry behindshare,mount, andstatus.src/plug.rs: embedssrc/skills/*/SKILL.mdin the binary and writes them to an agent's skills folder.src/skills/: the skills thatpluginstalls. Edit them here, then rebuild.src/sync.rs: the sync loop. Both commands run it.src/scan.rs: walks a folder and hashes each file. It also rejects unsafe paths from a peer.src/watch.rs: the file watcher. It sends 1 tick after 300ms with no changes.
- The hash is a habilis-network mesh id. The mesh uses all lookups: mDNS, DHT, and relay.
- The file list is the mesh
statedocument, an automerge CRDT (a data type that merges edits from many writers). Each entry holds the sha256 of a file and a blob ticket. - The file bytes go through the blob ticket, because a gossip frame holds at most 3840 bytes.
- Echo stop: each side keeps the last synced sha256 of each path. A change that matches it is the side's own echo, so the side skips it.
- Conflicts: if 2 sides edit 1 file at the same time, the last write wins.
- Hidden files and folders (
.git,.DS_Store) do not sync. - Empty folders do not sync.
- A rename syncs as a delete plus a create.
- Each side keeps a full copy of the folder.