@iambarryking/ag 3.0.1 → 3.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +88 -35
- package/dist/cli/parser.d.ts.map +1 -1
- package/dist/cli/parser.js +11 -21
- package/dist/cli/parser.js.map +1 -1
- package/dist/cli/repl.d.ts.map +1 -1
- package/dist/cli/repl.js +214 -129
- package/dist/cli/repl.js.map +1 -1
- package/dist/core/agent.d.ts +13 -1
- package/dist/core/agent.d.ts.map +1 -1
- package/dist/core/agent.js +74 -14
- package/dist/core/agent.js.map +1 -1
- package/dist/core/config.d.ts +1 -0
- package/dist/core/config.d.ts.map +1 -1
- package/dist/core/config.js.map +1 -1
- package/dist/core/registry.d.ts +11 -0
- package/dist/core/registry.d.ts.map +1 -0
- package/dist/core/registry.js +62 -0
- package/dist/core/registry.js.map +1 -0
- package/dist/core/skills.d.ts +14 -0
- package/dist/core/skills.d.ts.map +1 -0
- package/dist/core/skills.js +95 -0
- package/dist/core/skills.js.map +1 -0
- package/dist/core/types.d.ts.map +1 -1
- package/dist/memory/memory.d.ts.map +1 -1
- package/dist/memory/memory.js +5 -1
- package/dist/memory/memory.js.map +1 -1
- package/dist/tools/memory.d.ts.map +1 -1
- package/dist/tools/memory.js +16 -10
- package/dist/tools/memory.js.map +1 -1
- package/dist/tools/skill.d.ts +6 -0
- package/dist/tools/skill.d.ts.map +1 -0
- package/dist/tools/skill.js +20 -0
- package/dist/tools/skill.js.map +1 -0
- package/dist/tools/web.d.ts +3 -0
- package/dist/tools/web.d.ts.map +1 -0
- package/dist/tools/web.js +164 -0
- package/dist/tools/web.js.map +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -50,39 +50,42 @@ export OPENROUTER_API_KEY=sk-or-v1-...
|
|
|
50
50
|
|
|
51
51
|
## REPL Commands
|
|
52
52
|
|
|
53
|
+
All commands follow the pattern: `/noun` to show, `/noun subcommand` to act.
|
|
54
|
+
|
|
53
55
|
```
|
|
54
|
-
/help
|
|
55
|
-
/model
|
|
56
|
-
/model
|
|
57
|
-
/
|
|
58
|
-
/
|
|
59
|
-
/
|
|
60
|
-
/
|
|
61
|
-
/
|
|
62
|
-
/
|
|
63
|
-
/
|
|
64
|
-
/plan
|
|
65
|
-
/
|
|
66
|
-
/
|
|
67
|
-
/
|
|
68
|
-
/
|
|
69
|
-
/
|
|
70
|
-
/
|
|
56
|
+
/help Show all commands
|
|
57
|
+
/model Show current model
|
|
58
|
+
/model <name> Switch model (persists to config)
|
|
59
|
+
/model search [query] Browse OpenRouter models
|
|
60
|
+
/memory Show all memory + stats
|
|
61
|
+
/memory global Show global memory
|
|
62
|
+
/memory project Show project memory
|
|
63
|
+
/memory clear project|all Clear memory
|
|
64
|
+
/plan Show current plan
|
|
65
|
+
/plan list List all plans
|
|
66
|
+
/plan use <name> Activate an older plan
|
|
67
|
+
/config Show config + file paths
|
|
68
|
+
/config set <k> <v> Set a config value
|
|
69
|
+
/tools List loaded tools
|
|
70
|
+
/skill List installed skills
|
|
71
|
+
/skill search [query] Search skills.sh registry
|
|
72
|
+
/skill add <source> Install skill from registry
|
|
73
|
+
/skill remove <name> Uninstall a skill
|
|
74
|
+
/exit Exit
|
|
71
75
|
```
|
|
72
76
|
|
|
73
77
|
## Tools
|
|
74
78
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
|
78
|
-
|
|
79
|
-
| `
|
|
80
|
-
| `
|
|
81
|
-
| `
|
|
82
|
-
| `
|
|
83
|
-
| `
|
|
84
|
-
| `
|
|
85
|
-
| `git_push` | Push branch to origin. Outputs a compare URL for creating a PR. |
|
|
79
|
+
All action-based tools follow the pattern: `tool(action, ...params)`.
|
|
80
|
+
|
|
81
|
+
| Tool | Actions | Purpose |
|
|
82
|
+
|------|---------|---------|
|
|
83
|
+
| `bash` | — | Run any shell command |
|
|
84
|
+
| `memory` | `save` | Persist a fact to global or project memory |
|
|
85
|
+
| `plan` | `save`, `list`, `read` | Manage task plans |
|
|
86
|
+
| `git` | `status`, `init`, `branch`, `commit`, `push` | Git workflow |
|
|
87
|
+
| `web` | `fetch`, `search` | Fetch web pages, search for current info |
|
|
88
|
+
| `skill` | — | Activate a skill by name |
|
|
86
89
|
|
|
87
90
|
## Custom Tools
|
|
88
91
|
|
|
@@ -117,6 +120,37 @@ export default {
|
|
|
117
120
|
|
|
118
121
|
That's it. No config, no registry. Use `/tools` in the REPL to see what's loaded.
|
|
119
122
|
|
|
123
|
+
## Skills
|
|
124
|
+
|
|
125
|
+
Skills are reusable prompt instructions (with optional tools) that the agent activates on-demand. Browse and install from [skills.sh](https://skills.sh):
|
|
126
|
+
|
|
127
|
+
```bash
|
|
128
|
+
/skill search frontend # search the registry
|
|
129
|
+
/skill add anthropic/skills@frontend # install
|
|
130
|
+
/skill # list installed
|
|
131
|
+
/skill remove frontend # uninstall
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
Skills are SKILL.md files with YAML frontmatter:
|
|
135
|
+
|
|
136
|
+
```
|
|
137
|
+
~/.ag/skills/ # global (all projects)
|
|
138
|
+
.ag/skills/ # project-local (overrides global)
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
```markdown
|
|
142
|
+
---
|
|
143
|
+
name: my-skill
|
|
144
|
+
description: When to use this skill. The agent sees this to decide activation.
|
|
145
|
+
---
|
|
146
|
+
|
|
147
|
+
Your instructions here. The agent loads this content when the skill is activated.
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
Frontmatter fields: `name` (required), `description` (required), `tools: true` (look for tools.mjs alongside), `always: true` (always inject, don't wait for activation).
|
|
151
|
+
|
|
152
|
+
The agent sees skill names + descriptions in every prompt. When a task matches, it activates the skill automatically via the `skill` tool, loading the full instructions into context.
|
|
153
|
+
|
|
120
154
|
## Configuration
|
|
121
155
|
|
|
122
156
|
Persistent settings are stored in `~/.ag/config.json`:
|
|
@@ -126,12 +160,22 @@ Persistent settings are stored in `~/.ag/config.json`:
|
|
|
126
160
|
"apiKey": "sk-or-v1-...",
|
|
127
161
|
"model": "anthropic/claude-sonnet-4.6",
|
|
128
162
|
"baseURL": "https://openrouter.ai/api/v1",
|
|
129
|
-
"maxIterations": 25
|
|
163
|
+
"maxIterations": 25,
|
|
164
|
+
"tavilyApiKey": "tvly-..."
|
|
130
165
|
}
|
|
131
166
|
```
|
|
132
167
|
|
|
133
168
|
Set values via the REPL (`/config set model openai/gpt-4o`) or edit the file directly. CLI flags and environment variables always take priority over config file values.
|
|
134
169
|
|
|
170
|
+
For web search, get a free Tavily API key at [tavily.com](https://tavily.com) (no credit card needed). The agent prompts for it on first use, or set it manually:
|
|
171
|
+
|
|
172
|
+
```bash
|
|
173
|
+
export TAVILY_API_KEY=tvly-...
|
|
174
|
+
# or in the REPL:
|
|
175
|
+
/config set tavilyApiKey tvly-...
|
|
176
|
+
/config set TAVILY_API_KEY tvly-... # env var name also works
|
|
177
|
+
```
|
|
178
|
+
|
|
135
179
|
## Memory
|
|
136
180
|
|
|
137
181
|
Three tiers, all plain markdown you can edit directly:
|
|
@@ -140,6 +184,9 @@ Three tiers, all plain markdown you can edit directly:
|
|
|
140
184
|
~/.ag/
|
|
141
185
|
config.json # settings: API key, default model, base URL
|
|
142
186
|
memory.md # global: preferences, patterns
|
|
187
|
+
skills/ # installed skills (from skills.sh or manual)
|
|
188
|
+
frontend/SKILL.md
|
|
189
|
+
tools/ # custom tools (.mjs files)
|
|
143
190
|
projects/
|
|
144
191
|
<id>/
|
|
145
192
|
memory.md # project: architecture, decisions
|
|
@@ -148,7 +195,7 @@ Three tiers, all plain markdown you can edit directly:
|
|
|
148
195
|
history.jsonl # conversation history
|
|
149
196
|
```
|
|
150
197
|
|
|
151
|
-
All memory is injected into the system prompt on every API call (capped at ~6000 chars total to avoid context bloat). The agent reads it automatically and writes via `
|
|
198
|
+
All memory is injected into the system prompt on every API call (capped at ~6000 chars total to avoid context bloat). The agent reads it automatically and writes via the `memory` and `plan` tools.
|
|
152
199
|
|
|
153
200
|
### Git workflow with memory
|
|
154
201
|
|
|
@@ -186,7 +233,7 @@ Or set it permanently:
|
|
|
186
233
|
## When to use something else
|
|
187
234
|
|
|
188
235
|
- **Claude Code** -- if you have a subscription and want the full harness with parallel tool calls, MCP, and a polished UI. ag is not trying to replace it.
|
|
189
|
-
- **aider** -- if your workflow is git-centric (commit-per-change, diff-based editing).
|
|
236
|
+
- **aider** -- if your workflow is git-centric (commit-per-change, diff-based editing).
|
|
190
237
|
- **Cursor / Windsurf** -- if you want IDE integration. ag is terminal-only.
|
|
191
238
|
|
|
192
239
|
ag is for when you want a hackable, persistent, model-agnostic agent you fully control in ~600 lines of TypeScript.
|
|
@@ -197,15 +244,21 @@ ag is for when you want a hackable, persistent, model-agnostic agent you fully c
|
|
|
197
244
|
src/
|
|
198
245
|
cli.ts # entry point
|
|
199
246
|
cli/parser.ts # arg parsing + help
|
|
200
|
-
cli/repl.ts # interactive REPL
|
|
201
|
-
core/agent.ts # the loop
|
|
247
|
+
cli/repl.ts # interactive REPL (unified /noun commands)
|
|
248
|
+
core/agent.ts # the loop + skill activation
|
|
202
249
|
core/config.ts # persistent config (~/.ag/config.json)
|
|
250
|
+
core/skills.ts # skill discovery, parsing, loading
|
|
251
|
+
core/registry.ts # skills.sh search + GitHub install
|
|
203
252
|
core/types.ts # interfaces
|
|
204
253
|
core/colors.ts # ANSI colors (respects NO_COLOR)
|
|
254
|
+
core/version.ts # version from package.json
|
|
205
255
|
memory/memory.ts # three-tier file memory
|
|
206
256
|
tools/bash.ts # shell execution
|
|
207
|
-
tools/memory.ts #
|
|
208
|
-
tools/plan.ts #
|
|
257
|
+
tools/memory.ts # memory tool
|
|
258
|
+
tools/plan.ts # plan management tool
|
|
259
|
+
tools/git.ts # git operations tool
|
|
260
|
+
tools/web.ts # web fetch + search tool
|
|
261
|
+
tools/skill.ts # skill activation tool
|
|
209
262
|
```
|
|
210
263
|
|
|
211
264
|
Zero npm dependencies. Node.js 18+ and TypeScript.
|
package/dist/cli/parser.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../../src/cli/parser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,UAAU,GAAG;IAAE,UAAU,EAAE,MAAM,EAAE,CAAA;CAAE,CAiB/E;AAED,wBAAgB,QAAQ,IAAI,IAAI,
|
|
1
|
+
{"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../../src/cli/parser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,UAAU,GAAG;IAAE,UAAU,EAAE,MAAM,EAAE,CAAA;CAAE,CAiB/E;AAED,wBAAgB,QAAQ,IAAI,IAAI,CAiC/B"}
|
package/dist/cli/parser.js
CHANGED
|
@@ -24,7 +24,7 @@ export function parseArgs(args) {
|
|
|
24
24
|
}
|
|
25
25
|
export function showHelp() {
|
|
26
26
|
console.log(`
|
|
27
|
-
ag - Persistent AI coding agent with memory (any model via OpenRouter)
|
|
27
|
+
ag - Persistent AI coding agent with memory and skills (any model via OpenRouter)
|
|
28
28
|
|
|
29
29
|
Usage:
|
|
30
30
|
ag # Interactive REPL
|
|
@@ -41,29 +41,19 @@ Options:
|
|
|
41
41
|
--stats Show memory file locations and status
|
|
42
42
|
-h, --help Show this help
|
|
43
43
|
|
|
44
|
-
Config:
|
|
45
|
-
On first run, ag prompts for your API key and saves it to ~/.ag/config.json.
|
|
46
|
-
Use /config in the REPL to view or change persistent settings.
|
|
47
|
-
|
|
48
|
-
Memory (all files editable):
|
|
49
|
-
~/.ag/config.json Settings: API key, default model, base URL
|
|
50
|
-
~/.ag/memory.md Global: patterns, preferences, facts
|
|
51
|
-
~/.ag/projects/<id>/memory.md Project: architecture, decisions, gotchas
|
|
52
|
-
~/.ag/projects/<id>/plans/ Plans: timestamped, latest auto-loaded
|
|
53
|
-
~/.ag/projects/<id>/history.jsonl Conversation history
|
|
54
|
-
|
|
55
44
|
REPL commands:
|
|
56
|
-
/
|
|
57
|
-
/project
|
|
45
|
+
/model [name|search] Show, switch, or browse models
|
|
46
|
+
/memory [global|project|clear] Show or manage memory
|
|
47
|
+
/plan [list|use <name>] Show or manage plans
|
|
48
|
+
/config [set <k> <v>] Show or set config
|
|
49
|
+
/tools List loaded tools
|
|
50
|
+
/skill [search|add|remove] Manage skills from skills.sh
|
|
51
|
+
/help Show all commands
|
|
52
|
+
/exit Exit
|
|
58
53
|
|
|
59
54
|
Install:
|
|
60
|
-
npx @iambarryking/ag
|
|
61
|
-
npm install -g @iambarryking/ag
|
|
62
|
-
|
|
63
|
-
Examples:
|
|
64
|
-
ag "debug this typescript error"
|
|
65
|
-
ag -m google/gemini-2.5-flash "refactor this"
|
|
66
|
-
ag -b http://localhost:11434/v1 "hello" # Local Ollama
|
|
55
|
+
npx @iambarryking/ag # Run directly
|
|
56
|
+
npm install -g @iambarryking/ag # Install globally
|
|
67
57
|
`);
|
|
68
58
|
}
|
|
69
59
|
//# sourceMappingURL=parser.js.map
|
package/dist/cli/parser.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parser.js","sourceRoot":"","sources":["../../src/cli/parser.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,SAAS,CAAC,IAAc;IACtC,MAAM,OAAO,GAAe,EAAE,CAAC;IAC/B,MAAM,UAAU,GAAa,EAAE,CAAC;IAEhC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACrC,MAAM,GAAG,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;QACpB,IAAI,CAAC,GAAG,KAAK,SAAS,IAAI,GAAG,KAAK,IAAI,CAAC,IAAI,CAA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CAAC,aAAa,GAAG,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;aACzH,IAAI,GAAG,KAAK,SAAS;YAAE,OAAO,CAAC,KAAK,GAAG,IAAI,CAAC;aAC5C,IAAI,GAAG,KAAK,QAAQ,IAAI,GAAG,KAAK,IAAI;YAAE,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC;aAC1D,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC;YAAE,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACtD,CAAC;IAED,OAAO,EAAE,GAAG,OAAO,EAAE,UAAU,EAAE,CAAC;AACpC,CAAC;AAED,MAAM,UAAU,QAAQ;IACtB,OAAO,CAAC,GAAG,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+Bb,CAAC,CAAC;AACH,CAAC"}
|
package/dist/cli/repl.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"repl.d.ts","sourceRoot":"","sources":["../../src/cli/repl.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAA0B,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"repl.d.ts","sourceRoot":"","sources":["../../src/cli/repl.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAA0B,MAAM,kBAAkB,CAAC;AAWjE,qBAAa,IAAI;IACf,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAQ;IAC9B,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAY;gBAEnB,KAAK,EAAE,KAAK;IAKlB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;YAuCd,aAAa;IAiP3B,OAAO,CAAC,GAAG;CAGZ"}
|