Skip to content

Add --install-skill for agent skills and Cursor rules - #4

Merged
raymondchins merged 4 commits into
raymondchins:mainfrom
muhajirdev:feat/install-skill
Jun 14, 2026
Merged

Add --install-skill for agent skills and Cursor rules#4
raymondchins merged 4 commits into
raymondchins:mainfrom
muhajirdev:feat/install-skill

Conversation

@muhajirdev

@muhajirdev muhajirdev commented Jun 14, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds --install-skill so agents get persistent guidance on when and how to use agentmap before falling back to grep.

  • --install-skill CLI flag with --platform (claude, cursor, agents, all), --project / --global, and --dry-run
  • Ships skills/SKILL.md (Claude / agents skill) and skills/cursor-rule.mdc (Cursor always-on rule)
  • skills/install.mjs handles atomic writes and version stamping
  • Tests and README docs included

Install destinations

Platform Path
claude .claude/skills/agentmap/SKILL.md (or ~/.claude/... with --global)
agents .agents/skills/agentmap/SKILL.md
cursor .cursor/rules/agentmap.mdc (project only)

Usage

agentmap --install-skill                    # all platforms, project scope
agentmap --install-skill --platform cursor  # Cursor rule only
agentmap --install-skill --global --platform claude
agentmap --install-skill --dry-run

Motivation

Without a skill or rule, coding agents default to grep even when agentmap --find or --relates would be faster and more precise. This copies packaged agent guidance into the standard skill/rule locations each platform already reads.

Test plan

  • npm test — 127/127 pass (3 new install-skill tests)
  • agentmap --install-skill --dry-run in a sample repo
  • agentmap --install-skill --platform cursor and confirm .cursor/rules/agentmap.mdc is created
  • Verify Cursor picks up the always-on rule in a real session

Ship packaged SKILL.md and a Cursor always-on rule (graphify-style) so
agents know when to query agentmap before grep. Includes tests and docs.

Co-authored-by: Cursor <cursoragent@cursor.com>
@muhajirdev
muhajirdev marked this pull request as draft June 14, 2026 15:26
Describe --install-skill on its own merits without comparing to other tools.

Co-authored-by: Cursor <cursoragent@cursor.com>
…ot path

- test asserts version derived from package.json (was hardcoded 0.6.0 → would
  go red after merging onto main 0.6.1)
- dynamic-import skills/install.mjs inside the --install-skill branch and read
  VERSION inside installSkill(), so warm --any/--find queries never load it
  (matches the lazy ts-morph / lazy mcp.mjs discipline)
@raymondchins

Copy link
Copy Markdown
Owner

Thanks @muhajirdev! Solid addition — extends the agent-loop guidance to Cursor / Codex / OpenCode, and the security side is clean (whitelisted platforms, fixed literal path segments, atomic writes, no traversal).

I pushed one commit to your branch with two fixes:

  • The .agentmap_version assertion was hardcoded to /0\.6\.0/ and would have gone red after merging onto main (now 0.6.1), since install.mjs reads the version live from package.json — changed the test to derive the expected version from package.json.
  • Moved the installer to a lazy await import() inside the --install-skill branch and read VERSION inside installSkill(), so the warm --any / --find hot path never loads it (matches the existing lazy ts-morph / lazy mcp.mjs discipline).

Full suite green (127/127). Mark it Ready for review whenever you're happy and I'll merge. 🙏

(Optional, non-blocking follow-ups: a --global-scope test and an unknown---platform error-path test.)

@raymondchins
raymondchins marked this pull request as ready for review June 14, 2026 17:24
@raymondchins
raymondchins merged commit 2631356 into raymondchins:main Jun 14, 2026
4 of 5 checks passed
@muhajirdev
muhajirdev deleted the feat/install-skill branch June 14, 2026 17:59
raymondchins added a commit that referenced this pull request Jul 4, 2026
* Add --install-skill for agent skills and Cursor rules.

Ship packaged SKILL.md and a Cursor always-on rule (graphify-style) so
agents know when to query agentmap before grep. Includes tests and docs.

Co-authored-by: Cursor <cursoragent@cursor.com>

* Drop Graphify references from install-skill docs.

Describe --install-skill on its own merits without comparing to other tools.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(install-skill): version-agnostic test + lazy-load installer off hot path

- test asserts version derived from package.json (was hardcoded 0.6.0 → would
  go red after merging onto main 0.6.1)
- dynamic-import skills/install.mjs inside the --install-skill branch and read
  VERSION inside installSkill(), so warm --any/--find queries never load it
  (matches the lazy ts-morph / lazy mcp.mjs discipline)

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: raymondchins <raymondchin.s@gmail.com>
raymondchins added a commit that referenced this pull request Jul 26, 2026
The 120s watchdog signalled only $_am_pid. When the runner resolves to
fallback #4 (`npx --no-install @raymondchins/agentmap`), that PID is the
npx wrapper and the real work is a grandchild `node .../bin/agentmap`, so
killing the wrapper left the grandchild reparented to init and still
spinning a full core. Observed today: `npm exec @raymondchins/agentmap`
(pid 5361) whose child (pid 7386) survived and had to be killed by hand
at ~30 W each.

`set -m` puts the background job in its own process group (pgid == pid),
so `kill -- -$_am_pid` reaches wrapper and grandchildren. SIGTERM first
so a healthy run can flush, SIGKILL only if it ignores it; plain-pid
fallbacks cover shells that do not honour job control here.

Verified: with the old form a spinning grandchild survived at ppid=1,
100% CPU 8s after the watchdog fired; with this change it is reaped.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
raymondchins added a commit that referenced this pull request Jul 27, 2026
The 120s watchdog signalled only $_am_pid. When the runner resolves to
fallback #4 (`npx --no-install @raymondchins/agentmap`), that PID is the
npx wrapper and the real work is a grandchild `node .../bin/agentmap`, so
killing the wrapper left the grandchild reparented to init and still
spinning a full core. Observed today: `npm exec @raymondchins/agentmap`
(pid 5361) whose child (pid 7386) survived and had to be killed by hand
at ~30 W each.

`set -m` puts the background job in its own process group (pgid == pid),
so `kill -- -$_am_pid` reaches wrapper and grandchildren. SIGTERM first
so a healthy run can flush, SIGKILL only if it ignores it; plain-pid
fallbacks cover shells that do not honour job control here.

Verified: with the old form a spinning grandchild survived at ppid=1,
100% CPU 8s after the watchdog fired; with this change it is reaped.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants