@aman_asmuei/aman-agent 0.3.1 → 0.5.0

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 CHANGED
@@ -1,79 +1,415 @@
1
- # aman-agent
1
+ <p align="center">
2
+ <picture>
3
+ <source media="(prefers-color-scheme: dark)" srcset="https://img.shields.io/badge/aman--agent-runtime_layer-white?style=for-the-badge&labelColor=0d1117&color=58a6ff">
4
+ <img alt="aman-agent" src="https://img.shields.io/badge/aman--agent-runtime_layer-black?style=for-the-badge&labelColor=f6f8fa&color=24292f">
5
+ </picture>
6
+ </p>
2
7
 
3
- Your AI companion, running locally. Powered by the aman ecosystem.
8
+ <h1 align="center">aman-agent</h1>
9
+
10
+ <p align="center">
11
+ <strong>The AI companion that actually remembers you.</strong>
12
+ </p>
13
+
14
+ <p align="center">
15
+ <a href="https://www.npmjs.com/package/@aman_asmuei/aman-agent"><img src="https://img.shields.io/npm/v/@aman_asmuei/aman-agent?style=for-the-badge&logo=npm&logoColor=white&color=cb3837" alt="npm version" /></a>
16
+ &nbsp;
17
+ <a href="https://github.com/amanasmuei/aman-agent/actions"><img src="https://img.shields.io/github/actions/workflow/status/amanasmuei/aman-agent/ci.yml?style=for-the-badge&logo=github&label=CI" alt="CI status" /></a>
18
+ &nbsp;
19
+ <a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue?style=for-the-badge" alt="MIT License" /></a>
20
+ &nbsp;
21
+ <img src="https://img.shields.io/badge/node-%E2%89%A518-brightgreen?style=for-the-badge&logo=node.js&logoColor=white" alt="Node.js 18+" />
22
+ &nbsp;
23
+ <a href="https://github.com/amanasmuei/aman"><img src="https://img.shields.io/badge/part_of-aman_ecosystem-ff6b35?style=for-the-badge" alt="aman ecosystem" /></a>
24
+ </p>
25
+
26
+ <p align="center">
27
+ An AI companion that learns from every conversation, recalls relevant memories per message,<br/>
28
+ extracts knowledge silently, and adapts to your time of day — all running locally.
29
+ </p>
30
+
31
+ <p align="center">
32
+ <a href="#-quick-start">Quick Start</a> &bull;
33
+ <a href="#-intelligent-companion-features">Features</a> &bull;
34
+ <a href="#-how-it-works">How It Works</a> &bull;
35
+ <a href="#-commands">Commands</a> &bull;
36
+ <a href="#-supported-llms">LLMs</a> &bull;
37
+ <a href="#-the-ecosystem">Ecosystem</a>
38
+ </p>
39
+
40
+ ---
41
+
42
+ ## The Problem
43
+
44
+ AI coding assistants forget everything between sessions. You re-explain your stack, preferences, and boundaries every time. There's no single place where your AI loads its full context and just *works*.
45
+
46
+ Other "memory" solutions are just markdown files the AI reads on startup — they don't *learn* from conversation, they don't *recall* per-message, and they silently lose context when the window fills up.
47
+
48
+ ## The Solution
49
+
50
+ **aman-agent** is the first open-source AI companion that genuinely learns from conversation. It doesn't just store memories — it recalls them per-message, extracts new knowledge automatically, and uses your LLM to intelligently compress context instead of truncating it.
51
+
52
+ ```bash
53
+ npx @aman_asmuei/aman-agent
54
+ ```
55
+
56
+ > **Your AI knows who it is, what it remembers, what tools it has, what rules to follow, what time it is, and what reminders are due — before you say a word.**
57
+
58
+ ---
4
59
 
5
60
  ## Quick Start
6
61
 
62
+ ### 1. Run
63
+
7
64
  ```bash
65
+ # Run directly (always latest)
8
66
  npx @aman_asmuei/aman-agent
67
+
68
+ # Or install globally
69
+ npm install -g @aman_asmuei/aman-agent
9
70
  ```
10
71
 
11
- First run: configure your LLM (Claude or GPT). After that, just run and talk.
72
+ ### 2. Configure
12
73
 
13
- ## What it does
74
+ First run prompts for your LLM provider, API key, and model. Config saved to `~/.aman-agent/config.json`.
14
75
 
15
- Loads your entire aman ecosystem and runs a local AI agent:
76
+ ### 3. Talk
16
77
 
17
- - **Identity** (acore) — your AI knows who it is and who you are
18
- - **Memory** (amem) your AI remembers past sessions
19
- - **Tools** (akit) — your AI can use GitHub, search the web, query databases
20
- - **Workflows** (aflow) — your AI follows your defined processes
21
- - **Guardrails** (arules) — your AI respects your boundaries
22
- - **Skills** (askill) — your AI applies learned capabilities
78
+ ```bash
79
+ # Override model per session
80
+ aman-agent --model claude-opus-4-6
23
81
 
24
- ## Commands
82
+ # Adjust system prompt token budget
83
+ aman-agent --budget 12000
84
+ ```
85
+
86
+ ---
87
+
88
+ ## Intelligent Companion Features
89
+
90
+ ### Per-Message Memory Recall
91
+
92
+ Every message you send triggers a semantic search against your memory database. Relevant memories are injected into the AI's context for *that turn only* — so the AI always has the right context without bloating the conversation.
93
+
94
+ ```
95
+ You > Let's set up the auth service
96
+
97
+ Agent recalls:
98
+ - [decision] Auth service uses JWT tokens (confidence: 0.92)
99
+ - [preference] User prefers PostgreSQL (confidence: 0.88)
100
+ - [fact] Auth middleware rewrite driven by compliance (confidence: 0.75)
101
+
102
+ Aman > Based on our previous decisions, I'll set up JWT-based auth
103
+ with PostgreSQL, keeping the compliance requirements in mind...
104
+ ```
105
+
106
+ ### Hybrid Memory Extraction
107
+
108
+ After every response, the agent analyzes the conversation and extracts memories worth keeping. Preferences, facts, patterns, and topology are stored silently. Decisions and corrections require your confirmation.
109
+
110
+ ```
111
+ You > I think we should go with microservices for the payment system
112
+
113
+ Aman > That makes sense given the compliance isolation requirements...
114
+
115
+ Remember: "Payment system will use microservices architecture"? (y/N) y
116
+ [1 memory stored]
117
+ ```
118
+
119
+ ### LLM-Powered Context Summarization
120
+
121
+ When the conversation gets long, the agent uses your LLM to generate real summaries — preserving decisions, preferences, and action items. No more losing critical context to 150-character truncation.
122
+
123
+ ### Parallel Tool Execution
124
+
125
+ When the AI needs multiple tools, they run in parallel via `Promise.all` instead of sequentially. Faster responses, same guardrail checks.
126
+
127
+ ### Retry with Backoff
128
+
129
+ LLM calls and MCP tool calls automatically retry on transient errors (rate limits, timeouts) with exponential backoff and jitter. Auth errors fail immediately.
130
+
131
+ ### Time-Aware Greetings
132
+
133
+ The agent knows the time of day and day of week. It adapts its tone naturally — you'll notice the difference between a morning and a late-night session.
134
+
135
+ ### Reminders
136
+
137
+ ```
138
+ You > Remind me to review PR #42 by Thursday
139
+
140
+ Aman > I'll set that reminder for you.
141
+ [Reminder set: "Review PR #42" — due 2026-03-27]
142
+ ```
143
+
144
+ Next session:
145
+ ```
146
+ [OVERDUE] Review PR #42 (was due 2026-03-27)
147
+ ```
148
+
149
+ Reminders persist in SQLite across sessions. Set them, forget them, get nudged.
150
+
151
+ ### Memory Consolidation
152
+
153
+ On every startup, the agent automatically merges duplicate memories, prunes stale low-confidence ones, and promotes frequently-accessed entries.
154
+
155
+ ```
156
+ Memory health: 94% (merged 2 duplicates, pruned 1 stale)
157
+ ```
158
+
159
+ ### Structured Debug Logging
160
+
161
+ Every operation that can fail logs to `~/.aman-agent/debug.log` with structured JSON. No more silent failures — use `/debug` to see what's happening under the hood.
162
+
163
+ ---
164
+
165
+ ## How It Works
166
+
167
+ ```
168
+ ┌───────────────────────────────────────────────────────────┐
169
+ │ Your Terminal │
170
+ │ │
171
+ │ You > tell me about our auth decisions │
172
+ │ │
173
+ │ [recalling memories...] │
174
+ │ Agent > Based on your previous decisions: │
175
+ │ - OAuth2 with PKCE (decided 2 weeks ago) │
176
+ │ - JWT for API tokens... │
177
+ │ │
178
+ │ [1 memory stored] │
179
+ └──────────────────────┬────────────────────────────────────┘
180
+
181
+ ┌──────────────────────▼────────────────────────────────────┐
182
+ │ aman-agent runtime │
183
+ │ │
184
+ │ On Startup │
185
+ │ ┌────────────────────────────────────────────────┐ │
186
+ │ │ 1. Load ecosystem (identity, tools, rules...) │ │
187
+ │ │ 2. Connect MCP servers (aman-mcp + amem) │ │
188
+ │ │ 3. Consolidate memory (merge/prune/promote) │ │
189
+ │ │ 4. Check reminders (overdue/today/upcoming) │ │
190
+ │ │ 5. Inject time context (morning/evening/...) │ │
191
+ │ │ 6. Recall session context from memory │ │
192
+ │ └────────────────────────────────────────────────┘ │
193
+ │ │
194
+ │ Per Message │
195
+ │ ┌────────────────────────────────────────────────┐ │
196
+ │ │ 1. Semantic memory recall (top 5 relevant) │ │
197
+ │ │ 2. Augment system prompt with memories │ │
198
+ │ │ 3. Stream LLM response (with retry) │ │
199
+ │ │ 4. Execute tools in parallel (with guardrails) │ │
200
+ │ │ 5. Extract memories from response │ │
201
+ │ │ - Auto-store: preferences, facts, patterns │ │
202
+ │ │ - Confirm: decisions, corrections │ │
203
+ │ └────────────────────────────────────────────────┘ │
204
+ │ │
205
+ │ Context Management │
206
+ │ ┌────────────────────────────────────────────────┐ │
207
+ │ │ Auto-trim at 80K tokens │ │
208
+ │ │ LLM-powered summarization (not truncation) │ │
209
+ │ │ Fallback to text preview if LLM call fails │ │
210
+ │ └────────────────────────────────────────────────┘ │
211
+ │ │
212
+ │ MCP Integration │
213
+ │ ┌────────────────────────────────────────────────┐ │
214
+ │ │ aman-mcp → identity, tools, workflows, eval │ │
215
+ │ │ amem → memory, knowledge graph, reminders │ │
216
+ │ └────────────────────────────────────────────────┘ │
217
+ └───────────────────────────────────────────────────────────┘
218
+ ```
219
+
220
+ ### Session Lifecycle
25
221
 
26
- Inside the agent:
222
+ | Phase | What happens |
223
+ |:---|:---|
224
+ | **Start** | Load ecosystem, connect MCP, consolidate memory, check reminders, inject time context |
225
+ | **Each turn** | Recall relevant memories, stream response, execute tools in parallel, extract new memories |
226
+ | **Auto-trim** | LLM-powered summarization when approaching 80K tokens |
227
+ | **Exit** | Save conversation to amem, update session resume, optional session rating |
27
228
 
28
- | Command | What it does |
29
- |:--------|:-------------|
229
+ ---
230
+
231
+ ## Commands
232
+
233
+ | Command | Description |
234
+ |:---|:---|
30
235
  | `/help` | Show available commands |
31
- | `/identity` | View your AI identity |
32
- | `/tools` | View installed tools |
33
- | `/workflows` | View defined workflows |
34
- | `/rules` | View guardrails |
35
- | `/skills` | View installed skills |
236
+ | `/identity` | View identity `[update <section>]` |
237
+ | `/rules` | View guardrails `[add\|remove\|toggle ...]` |
238
+ | `/workflows` | View workflows `[add\|remove ...]` |
239
+ | `/tools` | View tools `[add\|remove ...]` |
240
+ | `/skills` | View skills `[install\|uninstall ...]` |
241
+ | `/eval` | View evaluation `[milestone ...]` |
242
+ | `/memory` | View memories `[search\|clear ...]` |
243
+ | `/decisions` | View decision log `[<project>]` |
244
+ | `/export` | Export conversation to markdown |
245
+ | `/debug` | Show debug log (last 20 entries) |
246
+ | `/status` | Ecosystem dashboard |
247
+ | `/doctor` | Health check all layers |
248
+ | `/save` | Save conversation to memory |
36
249
  | `/model` | Show current LLM model |
250
+ | `/update` | Check for updates |
251
+ | `/reconfig` | Reset LLM configuration |
37
252
  | `/clear` | Clear conversation history |
38
253
  | `/quit` | Exit |
39
254
 
255
+ ---
256
+
257
+ ## What It Loads
258
+
259
+ On every session start, aman-agent assembles your full AI context:
260
+
261
+ | Layer | Source | What it provides |
262
+ |:---|:---|:---|
263
+ | **Identity** | `~/.acore/core.md` | AI personality, your preferences, relationship state |
264
+ | **Memory** | `~/.amem/memory.db` | Past decisions, corrections, patterns, conversation history |
265
+ | **Reminders** | `~/.amem/memory.db` | Overdue, today, and upcoming reminders |
266
+ | **Tools** | `~/.akit/kit.md` | Available capabilities (GitHub, search, databases) |
267
+ | **Workflows** | `~/.aflow/flow.md` | Multi-step processes (code review, bug fix) |
268
+ | **Guardrails** | `~/.arules/rules.md` | Safety boundaries and permissions |
269
+ | **Skills** | `~/.askill/skills.md` | Deep domain expertise |
270
+ | **Time** | System clock | Time of day, day of week for tone adaptation |
271
+
272
+ All layers are optional — the agent works with whatever you've set up.
273
+
274
+ ### Token Budgeting
275
+
276
+ Layers are included by priority when space is limited:
277
+
278
+ ```
279
+ Identity (always) → Guardrails → Workflows → Tools → Skills (can truncate)
280
+ ```
281
+
282
+ Default budget: 8,000 tokens. Override with `--budget`.
283
+
284
+ ---
285
+
40
286
  ## Supported LLMs
41
287
 
42
- - **Claude** (Anthropic) recommended, supports tool use
43
- - **GPT** (OpenAI) — supports tool use
44
- - More coming (Gemini, Ollama)
288
+ | Provider | Models | Tool Use | Streaming |
289
+ |:---|:---|:---|:---|
290
+ | **Anthropic** | Claude Sonnet 4.5, Opus 4.6, Haiku 4.5 | Full | Full (with tools) |
291
+ | **OpenAI** | GPT-4o, GPT-4o Mini, o3 | Full | Full (with tools) |
292
+ | **Ollama** | Llama, Mistral, Gemma, any local model | Text only | Full |
293
+
294
+ ---
45
295
 
46
296
  ## Configuration
47
297
 
48
- Config stored in `~/.aman-agent/config.json`. Treat this file like a credential — it contains your API key.
298
+ Config is stored in `~/.aman-agent/config.json`:
49
299
 
50
300
  ```json
51
301
  {
52
302
  "provider": "anthropic",
53
303
  "apiKey": "sk-ant-...",
54
- "model": "claude-sonnet-4-5-20250514"
304
+ "model": "claude-sonnet-4-5-20250514",
305
+ "hooks": {
306
+ "memoryRecall": true,
307
+ "sessionResume": true,
308
+ "rulesCheck": true,
309
+ "workflowSuggest": true,
310
+ "evalPrompt": true,
311
+ "autoSessionSave": true,
312
+ "extractMemories": true
313
+ }
55
314
  }
56
315
  ```
57
316
 
58
- Override model per session:
59
- ```bash
60
- npx @aman_asmuei/aman-agent --model claude-opus-4-6
61
- ```
317
+ | Option | CLI Flag | Default |
318
+ |:---|:---|:---|
319
+ | Model override | `--model <id>` | From config |
320
+ | Token budget | `--budget <n>` | 8000 |
321
+
322
+ ### Hook Toggles
323
+
324
+ All hooks are on by default. Disable any in `config.json`:
325
+
326
+ | Hook | What it controls |
327
+ |:---|:---|
328
+ | `memoryRecall` | Load memory context on session start |
329
+ | `sessionResume` | Resume from last session state |
330
+ | `rulesCheck` | Pre-tool guardrail enforcement |
331
+ | `workflowSuggest` | Auto-detect matching workflows |
332
+ | `evalPrompt` | Session rating on exit |
333
+ | `autoSessionSave` | Save conversation to amem on exit |
334
+ | `extractMemories` | Auto-extract memories from conversation |
335
+
336
+ > Treat the config file like a credential — it contains your API key.
337
+
338
+ ---
62
339
 
63
340
  ## The Ecosystem
64
341
 
65
342
  ```
66
343
  aman
67
- ├── acore → identity
68
- ├── amem → memory
69
- ├── akit → tools
70
- ├── aflow → workflows
71
- ├── arules → guardrails
72
- ├── aeval evaluation
73
- ├── askill skills
74
- └── aman-agent runtime ← THIS
344
+ ├── acore → identity → who your AI IS
345
+ ├── amem → memory → what your AI KNOWS
346
+ ├── akit → tools → what your AI CAN DO
347
+ ├── aflow → workflows → HOW your AI works
348
+ ├── arules → guardrails → what your AI WON'T do
349
+ ├── askill skills → what your AI MASTERS
350
+ ├── aeval evaluation → how GOOD your AI is
351
+ ├── achannel channels → WHERE your AI lives
352
+ └── aman-agent → runtime → the engine ← YOU ARE HERE
353
+ ```
354
+
355
+ <details>
356
+ <summary><strong>Full ecosystem packages</strong></summary>
357
+
358
+ | Layer | Package | What it does |
359
+ |:---|:---|:---|
360
+ | Identity | [acore](https://github.com/amanasmuei/acore) | Personality, values, relationship memory |
361
+ | Memory | [amem](https://github.com/amanasmuei/amem) | Persistent memory with knowledge graph + reminders (MCP) |
362
+ | Tools | [akit](https://github.com/amanasmuei/akit) | Portable AI tools (MCP + manual fallback) |
363
+ | Workflows | [aflow](https://github.com/amanasmuei/aflow) | Reusable AI workflows |
364
+ | Guardrails | [arules](https://github.com/amanasmuei/arules) | Safety boundaries and permissions |
365
+ | Skills | [askill](https://github.com/amanasmuei/askill) | Domain expertise |
366
+ | Evaluation | [aeval](https://github.com/amanasmuei/aeval) | Relationship tracking |
367
+ | Channels | [achannel](https://github.com/amanasmuei/achannel) | Telegram, Discord, webhooks |
368
+ | **Unified** | **[aman](https://github.com/amanasmuei/aman)** | **One command to set up everything** |
369
+
370
+ </details>
371
+
372
+ ---
373
+
374
+ ## What Makes This Different
375
+
376
+ | Feature | aman-agent | MemoryCore / Others |
377
+ |:---|:---|:---|
378
+ | Memory storage | SQLite + embeddings + knowledge graph | Markdown files |
379
+ | Per-message recall | Semantic search every turn | Static blob at session start |
380
+ | Memory extraction | Auto-extract from conversation (LLM) | AI must manually write to files |
381
+ | Context compression | LLM-powered summarization | Truncation or line limits |
382
+ | Tool execution | Parallel with guardrail checks | Sequential or none |
383
+ | Reminders | Persistent, cross-session, deadline-aware | None |
384
+ | Error handling | Structured JSON debug log | Silent failures |
385
+ | Multi-LLM | Anthropic, OpenAI, Ollama | Usually single provider |
386
+ | Reliability | Retry with exponential backoff | Single attempt |
387
+
388
+ ---
389
+
390
+ ## Contributing
391
+
392
+ ```bash
393
+ git clone https://github.com/amanasmuei/aman-agent.git
394
+ cd aman-agent && npm install
395
+ npm run build # zero errors
396
+ npm test # 84 tests pass
75
397
  ```
76
398
 
77
- ## License
399
+ PRs welcome. See [Issues](https://github.com/amanasmuei/aman-agent/issues).
400
+
401
+ ---
402
+
403
+ <p align="center">
404
+ Built by <a href="https://github.com/amanasmuei"><strong>Aman Asmuei</strong></a>
405
+ </p>
406
+
407
+ <p align="center">
408
+ <a href="https://github.com/amanasmuei/aman-agent">GitHub</a> &middot;
409
+ <a href="https://www.npmjs.com/package/@aman_asmuei/aman-agent">npm</a> &middot;
410
+ <a href="https://github.com/amanasmuei/aman-agent/issues">Issues</a>
411
+ </p>
78
412
 
79
- MIT
413
+ <p align="center">
414
+ <sub>MIT License</sub>
415
+ </p>