feat: add agent instruction files to all templates#22
Conversation
Add AGENTS.md with ICP documentation and skills discovery instructions to every project template. Coding agents that read this file will automatically find the llms.txt docs and fetch relevant IC development skills on-demand. Add CLAUDE.md that points to AGENTS.md for Claude Code compatibility.
|
Symlinks are not supported by cargo-generate: Otherwise we could just symlink to |
Replace the duplicated AGENTS.md and CLAUDE.md in each template with a single _shared/write-agent-files.rhai script that generates both files via cargo-generate's post hook. This keeps a single source of truth for the agent instructions content.
Instruct agents to check if a matching skill is already loaded in their context before fetching from the remote registry. Avoids redundant web requests for agents that already have IC skills available.
ICP Agent Rules
Include the most common pitfalls from the skills repo (e.g., "Never hard-code canister IDs", "Always pin recipe versions in icp.yaml", "Use certified variables for frontend data"). This turns the file from a signpost into a mini-system prompt that actually prevents 90 % of the hallucinations agents still make on ICP.2. Add auto-install + update workflow (medium effort, huge UX win)Agents are lazy. Make it zero-friction:After icp new my-project, automatically suggest or run npx skills add dfinity/icskills (with a --yes flag for CI/headless).
|
|
And secondly ...Cognitive Packets + SKC: The Missing Memory Layer for Autonomous Agents |
|
Thanks for the detailed feedback, Kurt! The current design is intentionally minimal — AGENTS.md is a bootstrap file, not a knowledge base. The heavy lifting happens in the skills registry:
The flow is: agent reads AGENTS.md → fetches the index → knows what's available → fetches the right skill on demand. That keeps AGENTS.md durable and the registry authoritative. Some of the other suggestions (new CLI commands, Regarding agent memory (comment 2) — that's an interesting but separate topic. It would need to be set up per project by individual maintainers rather than baked into templates. There's active exploration in this space, e.g. Gas Town. Worth its own discussion. On that note — we're planning to enable the Discussions feature on https://github.com/dfinity/icskills soon, so there'll be a proper place to provide feedback and discuss how we can improve agent-assisted ICP development. Would love to continue some of these ideas there! |
|
Nice one Marc! Took a look at Gas Town impressive, orchestration
engineering for sure, the Dolt/Git-worktree approach to isolated agent
state is clever and the traction speaks for itself.
That said, it's solving session continuity on centralized infrastructure.
Whoever runs the Beads instance is the trust anchor (being picky now but
details matter here) there's no answer for trustless multi-party agent
memory there.
That's exactly where ICP flips the model. Orthogonal persistence +
canisters gives you agent memory that's replicated, tamperproof, and
on-chain natively so no coordinator to trust. I've been working on
something along these lines with Cognitive Packets + SKC which takes it
further into typed, verifiable knowledge communication between agents.
Would love to bring that into the icskills Discussion once it's live.
Cheers
Kurt
…On Tue, 24 Mar 2026, 10:48 Marco Walz, ***@***.***> wrote:
*marc0olo* left a comment (dfinity/icp-cli-templates#22)
<#22 (comment)>
Thanks for the detailed feedback, Kurt!
The current design is intentionally minimal — AGENTS.md is a bootstrap
file, not a knowledge base. The heavy lifting happens in the skills
registry:
- *Task→skill mapping / decision tree*: The skills index already
contains descriptions that tell agents when to use each skill. Hardcoding a
mapping in AGENTS.md would duplicate that and go stale as skills evolve.
- *Inline pitfalls & guardrails*: These live inside each skill where
they're maintained alongside the implementation patterns. Duplicating them
here creates drift risk. The whole point of the registry is single source
of truth.
The flow is: agent reads AGENTS.md → fetches the index → knows what's
available → fetches the right skill on demand. That keeps AGENTS.md durable
and the registry authoritative.
Some of the other suggestions (new CLI commands, .skills/ folders, signed
files, usage tracking) are interesting but out of scope for this PR.
Regarding agent memory (comment 2) — that's an interesting but separate
topic. It would need to be set up per project by individual maintainers
rather than baked into templates. There's active exploration in this space,
e.g. Gas Town <https://github.com/steveyegge/gastown>. Worth its own
discussion.
On that note — we're planning to enable the Discussions feature on
https://github.com/dfinity/icskills soon, so there'll be a proper place
to provide feedback and discuss how we can improve agent-assisted ICP
development. Would love to continue some of these ideas there!
—
Reply to this email directly, view it on GitHub
<#22?email_source=notifications&email_token=BRMT2N34GHFGUCURN4ZAXG34SJDXJA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTIMJRGY2DCMZWGIZKM4TFMFZW63VHMNXW23LFNZ2KKZLWMVXHJLDGN5XXIZLSL5RWY2LDNM#issuecomment-4116413622>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/BRMT2N3L5MLVZLRQLVWXAIT4SJDXJAVCNFSM6AAAAACWY3SDXOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHM2DCMJWGQYTGNRSGI>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
the dolt db that beads uses can be remote and shared across agents. it lives in the git repository and is independent of branches, so agents can always verify the latest state of the shared dolt db before picking new tasks and deciding what to work on: I think all of this is very much in a liquid state and best practices are emerging all over the place as we speak. in general I like the idea of using ICP for shared agent knowledge, but it needs to make sense and ideally the solution has "serious" advantages over using other (existing) tooling. most importantly we need hands-on experiments to figure out what works best and make the ICP ecosystem a perfect place for agents to build. this is also where community involvement and sharing knowledge and experiences becomes very important. |
|
Fair point on Beads , I oversimplified. The refs/dolt/data being a
standalone git ref that agents can verify independently before picking
tasks is genuinely elegant. I'll correct that in the post.
And you're absolutely right that "serious advantages" is the right bar.
Theoretical elegance doesn't move ecosystems — working experiments do.
Here's where I think ICP has something worth testing concretely: the Crisp
protocol idea I've been developing proposes that agents shouldn't
communicate in alphanumeric language at all. Pure numeric tokens ,,for example ..where 2
means medical/critical, 3 means drone/physical AI — each one a key into a
Shared Knowledge Core (SKC) that resolves to a full semantic subgraph. No
parsing, no translation overhead, just math pointing into shared meaning.
The mycelium analogy isn't decorative here. Mycelium doesn't route chemical
signals using language it routes using numerical gradients across a
living topology. That's the model: agents communicating via Cognitive
Packets that are meaningless without the shared substrate basic idea here
...still needs work ..
(https://forum.dfinity.org/t/mycelium-inspired-native-ai-language/65765)
and ICP's orthogonal persistence + canister constellation is the only
infrastructure where that substrate can live without a trust anchor
operating it.
Anyways going off topic a bit.
The question worth experimnenting with: can an ICP-native SKC outperform a
shared Dolt DB for agent coordination when the knowledge graph grows large
and agents are geographically distributed? That's a real benchmark worth
running.
Excited for the icskills Discussions to go live ,, this is exactly the kind
of thing that needs community experimentation to settle.
…On Wed, 25 Mar 2026, 11:47 Marco Walz, ***@***.***> wrote:
*marc0olo* left a comment (dfinity/icp-cli-templates#22)
<#22 (comment)>
Whoever runs the Beads instance is the trust anchor (being picky now but
details matter here)
the dolt db that beads uses can be remote and shared across agents. it
lives in the git repository and is independent of branches, so agents can
always verify the latest state of the shared dolt db before picking new
tasks and deciding what to work on:
refs/dolt/data is a standalone git ref — it's not part of any branch's commit history
I think all of this is very much in a liquid state and best practices are
emerging all over the place as we speak.
in general I like the idea of using ICP for shared agent knowledge, but it
needs to make sense and ideally the solution has "serious" advantages over
using other (existing) tooling.
most importantly we need hands-on experiments to figure out what works
best and make the ICP ecosystem a perfect place for agents to build. this
is also where community involvement and sharing knowledge and experiences
becomes very important.
—
Reply to this email directly, view it on GitHub
<#22?email_source=notifications&email_token=BRMT2N4SDPA52CEUIQRTVBD4SOTMVA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTIMJSGUYTIOBWGYY2M4TFMFZW63VHMNXW23LFNZ2KKZLWMVXHJLDGN5XXIZLSL5RWY2LDNM#issuecomment-4125148661>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/BRMT2N3KDDFBEIADN2LGOQ34SOTMVAVCNFSM6AAAAACWY3SDXOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHM2DCMRVGE2DQNRWGE>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
Summary
Add agent instruction files (
AGENTS.mdandCLAUDE.md) to every project template so coding agents automatically discover ICP documentation and skills when developers scaffold a new project withicp new.How it works
A single shared Rhai script (
_shared/write-agent-files.rhai) generates both files via cargo-generate'sposthook. Each template'scargo-generate.tomlreferences this script, keeping a single source of truth for the content.Generated
AGENTS.mdinstructs any coding agent to:llms.txtGenerated
CLAUDE.mdpoints toAGENTS.mdfor Claude Code auto-discovery.Agent compatibility
CLAUDE.md→AGENTS.mdAGENTS.mdAGENTS.mdAGENTS.mdPrevious approach (commit 1)
The first commit added duplicated
AGENTS.mdandCLAUDE.mdfiles to each template directory. This was replaced in the second commit with the shared Rhai script to avoid maintaining identical content across 6+ templates.Note: cargo-generate does not support symlinks (issue #776), but it does support referencing Rhai scripts from parent directories via relative paths.