This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
# Build the project
cargo build
# Run all tests (unit tests + E2E tests)
cargo test
# Run a specific E2E test file
cargo test -- test_e2e --nocapture
# E2E tests are defined in tests/*.txtar files using the emx-testspec frameworkemx-note is a Zettelkasten-style note management CLI tool. The codebase is split into a library (src/lib.rs) and binary (src/main.rs).
- Capsa (Latin for "box"): A note collection/vault. Similar to Obsidian's vault concept.
- Default location:
~/.emx-notes/(configurable via--homeflag or$EMX_NOTE_HOME) - Agent prefixing: When
$EMX_AGENT_NAMEis set, capsa operations are automatically prefixed (e.g.,my-notesbecomesagent1-my-notes)
-
src/resolve.rs: Core resolution logic for capsa paths with multi-level priority:$EMX_NOTE_DEFAULTenvironment variable$EMX_AGENT_NAME(agent's default capsa is the agent name itself)- Hardcoded
.defaultdirectory
Handles agent prefixing, link files (INI-style external directories), and global vs agent-scoped operations.
-
src/cli.rs: CLI definition using clap derive macros. All commands and subcommands are defined here. -
src/cmd/: Individual command implementations. Each command module has arun()function that takes aResolveContext.
ResolveContext::new(home, global)reads environment variablesresolve_capsa(name)applies agent prefix and resolves toCapssaRefCapssaRefcontains the actual path (may be external if it's a link file)
- Agent prefix bypass: Use
-g/--globalflag to skip agent prefixing - Link files: Capsa can be a file (not directory) containing
[link]\ntarget = /path - Tag files: Stored as
#xxxx.mdin capsa root, with notes grouped by date - Daily notes: Created in
daily/YYYYMMDD/HHMMSS[-title].mdwith a link filedaily/YYYYMMDD.md
E2E tests use emx-testspec (in sibling directory ../emx-testspec), inspired by Go's testscript. Test files are .txtar format in tests/. The test runner executes commands and asserts on stdout/stderr/file existence.