agentspec
AGENTS.md4 starsChanged 8 months agoApache-2.0View on GitHub
agentspec is a Rust CLI + TUI for managing portable agent resources across AI coding tools: skills, agents, MCP servers, sessions, project configs/instruction files, memories, llms.txt, plans, permission profiles, hooks, and plugin manifests. Cargo workspace with two published crates: crates/agentspec (the CLI + TUI binary, fully synchronous) and crates/agentspec-sdk (a standalone SDK for bootstrapping AI-powered CLI tools: config and CLI scaffolding helpers; not consumed by the binary). Anchors, all under crates/agentspec/src/: the canonical IR is the Resource type and 8…
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.
Of the AGENTS.md files we read, the 35,266 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repositoryOne other file it gives its agents.
- llms.txtllms.txt
The file
We split this AGENTS.md into the rules it gives an agent
5 rules. About 0 are common, 0 are distinctive, and 5 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
5
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 61
Add corresponding CodingTool impl in crates/agentspec/src/tools/mod.rs via define_tool!
- Very specific: line 62
Add an anonymized fixture under crates/agentspec/tests/fixtures/ and extend the conformance suite (src/adapters/conformance_tests.rs, or …
- Very specific: line 66
Add one line in crates/agentspec/src/tools/mod.rs using the define_tool!
- Very specific: line 67
Add it to all_tools() vec
- Very specific: line 68
If the tool hosts MCP servers, give it an mcp: target.
≈ “Common” is an estimate: at least 1 in 5 of the 45,344 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
AGENTS.md
Identity
agentspec is a Rust CLI + TUI for managing portable agent resources across AI coding tools: skills, agents, MCP servers, sessions, project configs/instruction files, memories, llms.txt, plans, permission profiles, hooks, and plugin manifests.
Architecture
Cargo workspace with two published crates: crates/agentspec (the CLI + TUI binary, fully synchronous) and crates/agentspec-sdk (a standalone SDK for bootstrapping AI-powered CLI tools: config and CLI scaffolding helpers; not consumed by the binary).
Anchors, all under crates/agentspec/src/: the canonical IR is the Resource type and 8 ResourceKinds in ir.rs; every vendor format converts to/from it through the Adapter trait defined in adapters/mod.rs. AI tools are described by the CodingTool trait and the define_tool! macro in tools/mod.rs, which also declares each tool's McpDialect (where and in what format it stores MCP servers). Live inventory state (Config, TrackedResource, SHA-256 hashing as the lock) lives in inventory.rs; lockfile.rs is legacy .skill-lock.json serde kept for migration only. Each CLI command maps to one module under ops/ (clap definitions in cli.rs), session read adapters and the session IR live under session/, ratatui screens under tui/screens/, sentinel-keyed JSON settings edits (permissions) in jsonfile.rs, and MCP under mcp/ (mod.rs owns the canonical store and fan-out, dialect.rs translates one stored definition into each tool's native format). Use rg on a trait or type name to find the matching implementations.
Linking Mechanism
Resources live in the shared store (~/.agents/skills/, ~/.agents/agents/). Tools get real copies of the store version by default; --symlink opts into relative symlinks instead. Adoption never modifies or deletes originals: a resource adopted from a non-store location records that location as its local source, and sync re-copies source -> store -> tool links.
manage add <source> --all-tools resolves the source (local path, owner/repo, or git URL with optional #branch@subpath), copies to shared store, then copies into every installed tool's directory. Existing names are skipped (first-installed wins).
sync pipeline:
- Reconcile -- adopts existing links on disk that aren't tracked in config (handles links created by older versions or external tools)
- Refresh -- re-copies
local-sourced resources from their origins into the store - Link -- repairs missing tool copies only for explicitly tracked destinations; does not expand to new tools
- Reconcile -- applies ordinary change so it never reads as an integrity issue (
ops/reconcile.rs): recorded hashes follow observed files (project configs,llms.txt, memories, plans) and store updates todiscoveredresources, records for observed files that are gone are dropped, and tool copies that still match what agentspec last wrote are rewritten when the store moves on - Verify -- reports only what needs a person (
ops/verify.rs): a resource missing from the store, agitorlocalresource whose store copy changed, or a tool copy edited in place
Each copy link records the hash of what agentspec wrote there (ResourceLink::hash). That baseline is what separates a stale copy (safe to rewrite) from an edited one (never overwritten by sync; manage verify --repair backs it up, then rewrites it).
Relative symlinks (the --symlink strategy) are computed via pathdiff::diff_paths() so they survive home directory moves. Example: ~/.claude/skills/my-skill -> ../../.agents/skills/my-skill.
Profiles
A profile is a named group of skills and agents (profiles.rs holds the model, ops/profile.rs the commands). Definitions live in ~/.agents/profiles.yml; which profiles are on for this machine lives in Config::profile_state, falling back to each profile's enabled default. A resource is active when it is in no profile or in one that is on.
ops::profile::apply is the only code that acts on that state. For an inactive resource it removes each tool link and marks the record ResourceLink::suspended; for an active one it recreates suspended links with the recorded strategy. It runs after every profile command and inside sync. Everything else that walks links must treat a suspended link as absent on purpose: ensure_all_links does not repair it, refresh does not write to it, and link records a new link as suspended instead of creating it when the resource is off.
Commands
just check # fmt + clippy + test
just ci # fmt + clippy + build + test
just run # cargo run
cargo build # debug buildTop-level CLI commands: manage, status, sync, session, project, prune, profile, mcp, plans, permissions, plugins, hooks, fleet, worktree, bootstrap, tools, commands, update, version. The only output-format flag is the global --format human|json (default human).
bootstrap, tools, and commands are the discovery surface: bootstrap writes the skills bundled via include_str! from crates/agentspec/skills/ into the store and links them into every tool, tools reports what agentspec sees installed, and commands dumps the clap tree (JSON for agents, an indented list for people). Keep Cli's long_about in cli.rs accurate when the concepts change — it is the first thing both humans and agents read.
Code Style
- Rust 2024 edition
cargo fmt+cargo clippy -- -D warnings- Conventional commits (enforced by pre-commit hook)
- Minimize allocations; prefer
&stroverStringin function signatures
Adding a New Vendor Adapter
- Create
crates/agentspec/src/adapters/<vendor>.rs - Implement the
Adaptertrait (parse,emit,validate) - Register in
crates/agentspec/src/adapters/mod.rs(add amatcharm inadapter_for_path()) - Add corresponding
CodingToolimpl incrates/agentspec/src/tools/mod.rsviadefine_tool!macro - Add an anonymized fixture under
crates/agentspec/tests/fixtures/and extend the conformance suite (src/adapters/conformance_tests.rs, orsrc/session/adapters/conformance_tests.rsfor session parsers): a golden snapshot intests/snapshots/plus theparse(emit(parse(f))) == parse(f)round-trip case. Snapshot diffs are reviewable contract changes; regenerate deliberately withINSTA_UPDATE=always cargo test.
Adding a New AI Tool
- Add one line in
crates/agentspec/src/tools/mod.rsusing thedefine_tool!macro - Add it to
all_tools()vec - If the tool hosts MCP servers, give it an
mcp:target. Reuse an existingMcpDialectwhen the format matches; a genuinely new format needs a new variant plus read/write/remove arms inmcp/dialect.rsand a round-trip test there. Never invent a config path — leavemcpunset rather than guessing.
Bundled Skills
The skills bootstrap ships live in crates/agentspec/skills/, inside the published
package, not at the workspace root. cargo publish builds from a tarball containing only
the crate directory, so an include_str! reaching above it compiles locally and then fails
at release time. The Package CI job runs cargo publish --dry-run on every PR to catch
that class of break before a tag is cut.
MCP Dialects
One canonical definition per server lives in ~/.agents/mcp/<name>.json in the mcpServers
shape. mcp/dialect.rs translates it on write and back on read, so mcp add fans out to
every MCP-capable tool at once. Codex is edited through toml_edit so user comments and
formatting survive. mcp doctor prints the resolved table; mcp adopt pulls tool-native
servers back into the store.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

