Skip to content

feat: AGS v0 — cross-agent skill management CLI#1

Merged
Binb1 merged 13 commits intomainfrom
feat/ags-v0
Apr 6, 2026
Merged

feat: AGS v0 — cross-agent skill management CLI#1
Binb1 merged 13 commits intomainfrom
feat/ags-v0

Conversation

@Binb1
Copy link
Copy Markdown
Contributor

@Binb1 Binb1 commented Apr 3, 2026

Summary

AGS (Agent Skills) — a zero-dependency Bun CLI for managing AI agent skills across Claude Code, Cursor, and Codex. Built for agents first, humans second.

Commands

Command Purpose
ags scan Discover all skills, commands, agents, and rules across agents — grouped by type with health badges, colors, and scope filtering
ags skill-cost Context tax breakdown — per-skill token cost with bar charts relative to each agent's context limit
ags grab <url> Install a skill from a GitHub blob URL
ags rm <name> Remove a skill by name or path
ags stats Usage dashboard — sessions, PRs created, real token usage, MCP integrations, skill/subagent invocations, peak hours heatmap
ags list-agents Detect which agents are installed with skill counts

Design

  • Agent-first--json on every command with defined schemas, error codes, and structured output
  • Zero runtime deps — Bun built-ins for fs, fetch, spawn, glob. Manual argv parser, YAML frontmatter parser, ANSI colors — all from scratch
  • Exhaustive scanning — discovers skills, commands, agents (subagents), and rules across all three platforms. Handles both flat .md files and directory-based SKILL.md formats
  • Real usage stats — parses session .jsonl files directly for accurate token counts, PR links, MCP integration usage, and skill invocation tracking
  • Shell completions — static zsh/bash files for Homebrew auto-install
  • Cross-compile — darwin-arm64, darwin-x64, linux-x64 via bun build --compile

Files

src/
├── index.ts              # CLI entry, argv parsing, per-command --help
├── types.ts              # All shared interfaces and output schemas
├── commands/
│   ├── scan.ts           # Grouped tables with colors, badges, scope
│   ├── budget.ts         # Context cost with bar charts vs limits
│   ├── grab.ts           # GitHub raw fetch + install
│   ├── rm.ts             # Remove by name or path
│   ├── stats.ts          # Dashboard from session jsonl parsing
│   └── list-agents.ts    # Agent detection
├── core/
│   ├── agents.ts         # Agent registry (paths, formats, detection)
│   ├── scanner.ts        # Multi-agent discovery with deduplication
│   ├── parser.ts         # Zero-dep YAML frontmatter parser
│   ├── tokens.ts         # chars/4 estimation
│   └── health.ts         # Badge computation (STALE, HEAVY, etc.)
└── utils/
    ├── output.ts         # ANSI colors, tables, agent/type formatters
    ├── git.ts            # Staleness detection via git log
    └── github.ts         # GitHub URL parsing + raw content fetch

Test plan

  • ags scan discovers 23 items across Claude Code and Cursor (skills, commands, agents)
  • ags scan --scope local/global and --agent/--type filters work correctly
  • ags skill-cost shows context usage per agent with accurate bar charts
  • ags rm removes by name and cleans up empty directories
  • ags stats shows real session counts, PRs, tokens, integrations from jsonl files
  • ags stats --period 7d/30d/all-time filters correctly
  • ags list-agents detects installed agents
  • All --json outputs are valid parseable JSON
  • All <command> --help shows usage, options, and examples
  • TypeScript compiles clean (tsc --noEmit)
  • No hardcoded personal paths or usernames

🤖 Generated with Claude Code

Zero-dependency Bun CLI that discovers, measures, and manages AI agent
skills across Claude Code, Cursor, and Codex.

Commands:
  scan        — discover all skills, commands, agents, and rules
                with health badges, scope/type/agent filtering,
                and colored grouped output
  skill-cost  — context tax breakdown per agent with bar charts
                and optimization suggestions
  grab        — install skills from GitHub blob URLs
  rm          — remove skills by name or path
  stats       — usage dashboard with sessions, PRs created,
                token usage, MCP integrations, skill/subagent
                invocations, and peak hours heatmap
  list-agents — detect installed agents with skill counts

Design:
- Agent-first: --json on every command for structured agent consumption
- Zero runtime deps: Bun built-ins for fs, fetch, spawn, glob
- Scans Claude Code, Cursor, and Codex directories exhaustively
  (skills, commands, agents, rules — both flat .md and SKILL.md formats)
- Ships with ags-manager SKILL.md for agent self-discovery
- Shell completions for zsh and bash (Homebrew auto-install)
- Cross-compile targets: darwin-arm64, darwin-x64, linux-x64

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
claude and others added 12 commits April 4, 2026 04:31
…cation

- Remove 7 unused functions: serializeFrontmatter, formatNum, isGitRepo,
  badgeSeverity, printSuccess, subheading, getAgentNames
- Export and share stripAnsi, pad, shortenPath from output.ts
- Extract parseScopeFlag utility (was duplicated in scan.ts and budget.ts)
- Extract expandPattern utility for tilde expansion (was duplicated in
  agents.ts and grab.ts)
- Consolidate isAgentInstalled into one-liner using getBinaryPath
- Collapse parseGitHubUrl from two branches into one
- Replace heading() wrapper with direct c.bold() calls
- Simplify extractMcpService to use a regex lookup table
- Fix daysAgo duplication in budget.ts suggestion generation

Net: -154 lines across 12 files with no behavior changes.

https://claude.ai/code/session_01Y39PzBHtkF77d3DaqcZMpt
- Sanitize skill name in grab to strip path separators and ../ sequences
  (prevents writing files outside intended skills directory)
- Add 10s fetch timeout and 1MB response size limit in fetchRawContent
- Skip >50MB session files in stats to prevent memory exhaustion
- Tighten rm path matching to require "/" boundary in endsWith check

https://claude.ai/code/session_01Y39PzBHtkF77d3DaqcZMpt
- Security: cap fetch body size regardless of content-length header
- Performance: stream JSONL parsing in stats instead of readFileSync
- Accuracy: word+symbol token estimation replacing naive length/4
- Safety: add --dry-run flag for grab and rm commands
- UX: support short flags (-j, -a), --key=value syntax in arg parser
- Parser: proper multi-line string support (| and >) in YAML frontmatter
- Fix: cleanDirName strips only actual HOME prefix, not project names
- Fix: JSON output in grab/rm uses explicit return after printJson
- Perf: memoize findProjectRoot to avoid repeated fs walks
- Tests: add 61 unit tests for parser, tokens, health, github, args

https://claude.ai/code/session_01879LywhiKaXPsPbcsGgpZi
- Cut from 61 to 15 focused regression tests
- Remove args.test.ts (was testing duplicated code)
- Add CI workflow: typecheck + test on push/PR to main

https://claude.ai/code/session_01879LywhiKaXPsPbcsGgpZi
…ICPYr

Optimize memory usage, improve YAML parsing, and add CLI enhancements
…ersion

- Remove `init`, `export`, `completions` from shell completions since
  those commands don't exist yet — tab-completing them gave Unknown command
- Add missing `--dry-run` to grab/rm completions
- Remove broken completions generation step from build.ts (it called a
  non-existent `completions` subcommand, silently failing via .quiet())
- Read VERSION from package.json instead of hardcoding in index.ts

https://claude.ai/code/session_017bCbeFBwAH8ZcBP4YXLwiF
Remove export, init, and completions commands; add dry-run flags
… agent playbook

New commands:
- `ags context` — full context map showing everything loaded before first message
- `ags lint` — validate skill files with 9 quality rules
- `ags list-skills` — focused skill inventory with token costs

Rewrites SKILL.md from a dry API reference into a proactive playbook that
teaches agents WHEN to reach for ags without being asked.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ALE badge

- Remove list-skills and list-agents as separate commands
- scan --type skill replaces list-skills, scan --installed replaces list-agents
- Fix STALE badge false positive: only apply to project-scope skills (user-level
  skills report install date as mtime, not relevance)
- Fix git.ts: run git log in file's own directory, not cwd
- Extract shared helpers to output.ts (formatScope, parseAgentFlag)
- Clean up unused imports across lint.ts, context.ts
- Update completions, help text, SKILL.md playbook
- Net -175 lines

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@Binb1 Binb1 merged commit 28586f1 into main Apr 6, 2026
1 check passed
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