@aman_asmuei/aman-agent 0.31.0 → 0.33.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 +166 -37
- package/dist/delegate.js +61 -49
- package/dist/delegate.js.map +1 -1
- package/dist/index.js +1076 -428
- package/dist/index.js.map +1 -1
- package/package.json +4 -1
package/README.md
CHANGED
|
@@ -17,17 +17,17 @@
|
|
|
17
17
|
|
|
18
18
|
<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>
|
|
19
19
|
|
|
20
|
-
<img src="https://img.shields.io/badge/tests-
|
|
20
|
+
<img src="https://img.shields.io/badge/tests-531_passing-brightgreen?style=for-the-badge&logo=vitest&logoColor=white" alt="531 tests passing" />
|
|
21
21
|
|
|
22
22
|
<a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue?style=for-the-badge" alt="MIT License" /></a>
|
|
23
23
|
</p>
|
|
24
24
|
|
|
25
25
|
<p align="center">
|
|
26
|
-
<img src="https://img.shields.io/badge/node-%E2%89%
|
|
26
|
+
<img src="https://img.shields.io/badge/node-%E2%89%A518-brightgreen?style=flat-square&logo=node.js&logoColor=white" alt="Node.js 18+" />
|
|
27
27
|
|
|
28
28
|
<img src="https://img.shields.io/badge/typescript-strict-3178c6?style=flat-square&logo=typescript&logoColor=white" alt="Strict TypeScript" />
|
|
29
29
|
|
|
30
|
-
<img src="https://img.shields.io/badge/bundle-
|
|
30
|
+
<img src="https://img.shields.io/badge/bundle-384_KB-informational?style=flat-square" alt="Bundle size: 384 KB" />
|
|
31
31
|
|
|
32
32
|
<img src="https://img.shields.io/badge/LLMs-6_providers-8a2be2?style=flat-square" alt="6 LLM providers" />
|
|
33
33
|
|
|
@@ -39,7 +39,9 @@
|
|
|
39
39
|
</p>
|
|
40
40
|
|
|
41
41
|
<p align="center">
|
|
42
|
+
<a href="#whats-new-in-v0330"><kbd> What's New </kbd></a>
|
|
42
43
|
<a href="#quick-start"><kbd> Quick Start </kbd></a>
|
|
44
|
+
<a href="#project-dev-mode-recommended"><kbd> Dev Mode </kbd></a>
|
|
43
45
|
<a href="#architecture-at-a-glance"><kbd> Architecture </kbd></a>
|
|
44
46
|
<a href="#features"><kbd> Features </kbd></a>
|
|
45
47
|
<a href="#commands"><kbd> Commands </kbd></a>
|
|
@@ -50,7 +52,7 @@
|
|
|
50
52
|
|
|
51
53
|
<p align="center">
|
|
52
54
|
<sub>
|
|
53
|
-
<b>
|
|
55
|
+
<b>Install in 10 seconds →</b> <code>curl -fsSL https://raw.githubusercontent.com/amanasmuei/aman-agent/main/install.sh | bash</code>
|
|
54
56
|
</sub>
|
|
55
57
|
</p>
|
|
56
58
|
|
|
@@ -59,12 +61,13 @@
|
|
|
59
61
|
<details>
|
|
60
62
|
<summary><strong>Table of Contents</strong></summary>
|
|
61
63
|
|
|
62
|
-
- [What's New](#whats-new-in-
|
|
64
|
+
- [What's New](#whats-new-in-v0330)
|
|
63
65
|
- [The Problem](#the-problem)
|
|
64
66
|
- [The Solution](#the-solution)
|
|
65
67
|
- [Architecture at a Glance](#architecture-at-a-glance)
|
|
66
68
|
- [Quick Start](#quick-start)
|
|
67
69
|
- [Usage Guide](#usage-guide)
|
|
70
|
+
- [Project Dev Mode](#project-dev-mode-recommended)
|
|
68
71
|
- [Your First Conversation](#your-first-conversation)
|
|
69
72
|
- [How Memory Works](#how-memory-works)
|
|
70
73
|
- [Files & Images](#working-with-files--images)
|
|
@@ -94,42 +97,69 @@
|
|
|
94
97
|
|
|
95
98
|
---
|
|
96
99
|
|
|
97
|
-
## What's New in v0.
|
|
100
|
+
## What's New in v0.33.0
|
|
98
101
|
|
|
99
|
-
> **
|
|
100
|
-
> Multiple `aman-agent` instances on the same machine can now discover each other via a local registry and delegate tasks to each other over the MCP protocol. No new wire format, no broker, no new runtime daemon.
|
|
102
|
+
> **One command. Full context. Zero setup.**
|
|
101
103
|
|
|
102
|
-
|
|
103
|
-
<tr>
|
|
104
|
-
<td width="33%" valign="top">
|
|
104
|
+
### `aman-agent dev` — Your New Way to Start Coding
|
|
105
105
|
|
|
106
|
-
|
|
106
|
+
```bash
|
|
107
|
+
cd ~/projects/amantrade && aman-agent dev
|
|
108
|
+
```
|
|
107
109
|
|
|
108
|
-
|
|
110
|
+
Open any project, and aman-agent **automatically detects your stack**, **recalls your past decisions from memory**, and **generates a project-specific CLAUDE.md** — then launches Claude Code with everything loaded. No more re-explaining yourself.
|
|
109
111
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
+
```
|
|
113
|
+
$ aman-agent dev ~/projects/amantrade
|
|
112
114
|
|
|
113
|
-
|
|
115
|
+
Detected: Go (Fiber) + Postgresql + Docker + Github-actions
|
|
116
|
+
Recalled: 8 memories (4 decisions, 3 corrections, 1 convention)
|
|
117
|
+
✓ CLAUDE.md written (template mode)
|
|
114
118
|
|
|
115
|
-
|
|
119
|
+
Launching Claude Code...
|
|
120
|
+
```
|
|
116
121
|
|
|
117
|
-
|
|
118
|
-
|
|
122
|
+
| Flag | What it does |
|
|
123
|
+
|:---|:---|
|
|
124
|
+
| `--smart` | Use your configured LLM to synthesize a smarter CLAUDE.md |
|
|
125
|
+
| `--no-launch` | Generate CLAUDE.md only, don't start Claude Code |
|
|
126
|
+
| `--diff` | Preview what would change without writing |
|
|
127
|
+
| `--force` | Regenerate even if CLAUDE.md is fresh |
|
|
119
128
|
|
|
120
|
-
|
|
129
|
+
Works with **multiple projects** simultaneously — each terminal gets its own `aman-agent dev`, all sharing the same memory database. Decisions from one project flow into the next.
|
|
121
130
|
|
|
122
|
-
|
|
131
|
+
---
|
|
123
132
|
|
|
124
|
-
|
|
125
|
-
</
|
|
126
|
-
</table>
|
|
133
|
+
<details>
|
|
134
|
+
<summary><strong>v0.32.0 — Install anywhere, zero prerequisites</strong></summary>
|
|
127
135
|
|
|
128
|
-
|
|
136
|
+
### Install on any machine — no Node.js required
|
|
137
|
+
|
|
138
|
+
```bash
|
|
139
|
+
curl -fsSL https://raw.githubusercontent.com/amanasmuei/aman-agent/main/install.sh | bash
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
Works on **Linux** (x64, arm64, armv7l), **macOS** (x64, Apple Silicon), **Raspberry Pi**, **VPS**, and **servers**. Vendors Node.js 22 LTS invisibly. No sudo needed.
|
|
143
|
+
|
|
144
|
+
| Feature | Details |
|
|
145
|
+
|:---|:---|
|
|
146
|
+
| **Consolidated config** | All state now lives under `~/.aman-agent/` — one directory to backup, sync, or `scp` to a new machine. Existing users are auto-migrated on first run. |
|
|
147
|
+
| **Docker support** | `docker run -it -e ANTHROPIC_API_KEY=sk-... ghcr.io/amanasmuei/aman-agent` — multi-arch image (amd64 + arm64). |
|
|
148
|
+
| **`aman-agent setup`** | Full configuration wizard — provider, identity, and presets. |
|
|
149
|
+
| **`aman-agent update`** | Self-update, works with both vendored and npm installs. |
|
|
150
|
+
| **`aman-agent uninstall`** | Clean removal of all data and config. |
|
|
151
|
+
| **Headless mode** | Auto-detects LLM provider from env vars. Clean error when no TTY (systemd, Docker, CI). |
|
|
152
|
+
|
|
153
|
+
</details>
|
|
129
154
|
|
|
130
155
|
<details>
|
|
131
156
|
<summary><strong>Highlights from earlier releases</strong></summary>
|
|
132
157
|
|
|
158
|
+
**v0.31 — Multi-agent (A2A) via MCP server mode**
|
|
159
|
+
- `aman-agent serve` runs any profile as a local MCP server
|
|
160
|
+
- `/delegate @coder <task>` for cross-agent delegation
|
|
161
|
+
- `/agents list|info|ping` for discovery and health checks
|
|
162
|
+
|
|
133
163
|
**v0.30 — Agent hardening**
|
|
134
164
|
- Delegation confirmation prompts (no more silent sub-agents)
|
|
135
165
|
- Persistent background task state surviving crashes
|
|
@@ -247,10 +277,11 @@ flowchart LR
|
|
|
247
277
|
| `skill-engine.ts` + `crystallization.ts` | Auto-triggers domain skills from context; promotes post-mortem lessons into reusable, versioned skills | `src/skill-engine.ts`, `src/crystallization.ts` |
|
|
248
278
|
| `user-model.ts` + `personality.ts` | Cross-session trust (EMA), sentiment baseline, burnout risk, time-of-day tone shifts, wellbeing nudges | `src/user-model.ts`, `src/personality.ts` |
|
|
249
279
|
| `observation.ts` + `postmortem.ts` | Passive session telemetry + LLM-generated structured post-mortems on session end | `src/observation.ts`, `src/postmortem.ts` |
|
|
280
|
+
| `dev/` | Project stack detection, context assembly, CLAUDE.md generation — powers `aman-agent dev` | `src/dev/` |
|
|
250
281
|
| `llm/` | 6 pluggable providers — Anthropic, OpenAI, Ollama, GitHub Copilot, OpenAI-compatible, Claude Code CLI | `src/llm/` |
|
|
251
282
|
| `mcp/` | MCP v1.27 client with stdio transport and auto-reconnect | `src/mcp/` |
|
|
252
283
|
|
|
253
|
-
**Stateless by default.** All state lives in `~/.
|
|
284
|
+
**Stateless by default.** All state lives in `~/.aman-agent/` — identity, rules, workflows, skills, eval, and memory in one portable directory. Nothing leaves your machine except what you send to your chosen LLM.
|
|
254
285
|
|
|
255
286
|
</details>
|
|
256
287
|
|
|
@@ -258,14 +289,27 @@ flowchart LR
|
|
|
258
289
|
|
|
259
290
|
## Quick Start
|
|
260
291
|
|
|
261
|
-
### 1.
|
|
292
|
+
### 1. Install
|
|
262
293
|
|
|
263
294
|
```bash
|
|
264
|
-
#
|
|
265
|
-
|
|
295
|
+
# One-liner install (no Node.js required) — Linux, macOS, Raspberry Pi
|
|
296
|
+
curl -fsSL https://raw.githubusercontent.com/amanasmuei/aman-agent/main/install.sh | bash
|
|
266
297
|
|
|
267
|
-
# Or
|
|
298
|
+
# Or via npm (if you already have Node.js 18+)
|
|
268
299
|
npm install -g @aman_asmuei/aman-agent
|
|
300
|
+
|
|
301
|
+
# Or via Docker
|
|
302
|
+
docker run -it -e ANTHROPIC_API_KEY=sk-... ghcr.io/amanasmuei/aman-agent
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
### 2. Run
|
|
306
|
+
|
|
307
|
+
```bash
|
|
308
|
+
# Start a conversation
|
|
309
|
+
aman-agent
|
|
310
|
+
|
|
311
|
+
# Or jump straight into a project with full context
|
|
312
|
+
aman-agent dev ~/projects/my-app
|
|
269
313
|
```
|
|
270
314
|
|
|
271
315
|
**Zero config if you already have an API key in your environment:**
|
|
@@ -327,6 +371,70 @@ aman-agent --budget 12000
|
|
|
327
371
|
A step-by-step walkthrough of how to use aman-agent day-to-day. Click any section below to expand.
|
|
328
372
|
|
|
329
373
|
<details open>
|
|
374
|
+
<summary><strong>Project Dev Mode (recommended)</strong></summary>
|
|
375
|
+
|
|
376
|
+
### Project Dev Mode
|
|
377
|
+
|
|
378
|
+
The fastest way to start working on any project. One command sets up everything:
|
|
379
|
+
|
|
380
|
+
```bash
|
|
381
|
+
aman-agent dev
|
|
382
|
+
```
|
|
383
|
+
|
|
384
|
+
**What happens:**
|
|
385
|
+
|
|
386
|
+
1. **Stack Detection** — Scans your project directory for `package.json`, `go.mod`, `Cargo.toml`, `pyproject.toml`, `pubspec.yaml`, `docker-compose.yml`, `.github/workflows/`, and more
|
|
387
|
+
2. **Memory Recall** — Queries your amem database for past decisions, corrections, and conventions related to this project and stack
|
|
388
|
+
3. **Context Assembly** — Pulls your identity (acore), guardrails (arules), and developer preferences into a structured CLAUDE.md
|
|
389
|
+
4. **Auto-Launch** — Launches Claude Code in the project directory with full context loaded
|
|
390
|
+
|
|
391
|
+
```
|
|
392
|
+
$ aman-agent dev ~/projects/amantrade
|
|
393
|
+
|
|
394
|
+
Detected: Go (Fiber) + Postgresql + Docker + Github-actions
|
|
395
|
+
Recalled: 8 memories (4 decisions, 3 corrections, 1 convention)
|
|
396
|
+
✓ CLAUDE.md written (template mode)
|
|
397
|
+
|
|
398
|
+
Launching Claude Code...
|
|
399
|
+
```
|
|
400
|
+
|
|
401
|
+
**Smart mode** — Use your LLM to synthesize a more tailored CLAUDE.md:
|
|
402
|
+
|
|
403
|
+
```bash
|
|
404
|
+
aman-agent dev --smart
|
|
405
|
+
```
|
|
406
|
+
|
|
407
|
+
The LLM merges related corrections into single convention statements and removes redundancy. Falls back to template mode automatically if the LLM call fails.
|
|
408
|
+
|
|
409
|
+
**Multi-project workflow** — Each terminal is independent:
|
|
410
|
+
|
|
411
|
+
```bash
|
|
412
|
+
# Terminal 1
|
|
413
|
+
aman-agent dev ~/projects/amantrade
|
|
414
|
+
|
|
415
|
+
# Terminal 2
|
|
416
|
+
aman-agent dev ~/projects/aman-mcp
|
|
417
|
+
|
|
418
|
+
# Terminal 3
|
|
419
|
+
aman-agent dev ~/projects/new-api
|
|
420
|
+
```
|
|
421
|
+
|
|
422
|
+
All three share the same amem database. A decision you make in one project is available to the others on next run.
|
|
423
|
+
|
|
424
|
+
**Staleness detection** — If you've made new decisions since the last CLAUDE.md generation, `aman-agent dev` auto-updates it and shows you what changed:
|
|
425
|
+
|
|
426
|
+
```
|
|
427
|
+
✓ CLAUDE.md updated (3 changes)
|
|
428
|
+
+ Added: zerolog convention (from correction 2026-04-10)
|
|
429
|
+
+ Added: rate limiting at gateway level (from decision 2026-04-11)
|
|
430
|
+
- Removed: slog preference (superseded by zerolog correction)
|
|
431
|
+
```
|
|
432
|
+
|
|
433
|
+
If the CLAUDE.md is still fresh, it skips regeneration and launches Claude Code immediately.
|
|
434
|
+
|
|
435
|
+
</details>
|
|
436
|
+
|
|
437
|
+
<details>
|
|
330
438
|
<summary><strong>Your First Conversation</strong></summary>
|
|
331
439
|
|
|
332
440
|
### Your First Conversation
|
|
@@ -919,25 +1027,32 @@ Here's what a typical day looks like with aman-agent:
|
|
|
919
1027
|
|
|
920
1028
|
```
|
|
921
1029
|
Morning:
|
|
922
|
-
$
|
|
923
|
-
→
|
|
1030
|
+
$ aman-agent dev ~/projects/amantrade
|
|
1031
|
+
→ Detects stack: Go (Fiber) + PostgreSQL + Docker
|
|
1032
|
+
→ Recalls 12 memories (decisions, conventions, corrections)
|
|
1033
|
+
→ Generates project-specific CLAUDE.md
|
|
1034
|
+
→ Launches Claude Code — full context loaded, zero re-explaining
|
|
924
1035
|
→ "Welcome back. You're on step 3 of Auth API."
|
|
925
|
-
|
|
926
|
-
|
|
1036
|
+
|
|
1037
|
+
# Working on a second project in parallel?
|
|
1038
|
+
$ aman-agent dev ~/projects/aman-mcp # new terminal
|
|
1039
|
+
→ Same memory database, different project context
|
|
1040
|
+
→ Decisions from amantrade are available here too
|
|
927
1041
|
|
|
928
1042
|
Afternoon:
|
|
1043
|
+
→ Work on your plan, skills auto-activate as needed
|
|
1044
|
+
→ /plan done after each step, commit your work
|
|
929
1045
|
→ Personality shifts to steady pace
|
|
930
|
-
→ Skills level up as you demonstrate mastery
|
|
931
|
-
→ Knowledge library suggests snippets when relevant
|
|
932
1046
|
|
|
933
1047
|
Evening:
|
|
934
1048
|
→ /quit or Ctrl+C
|
|
935
1049
|
→ Session auto-saved to memory
|
|
936
|
-
→ Project context.md updated
|
|
937
1050
|
→ Plan progress persisted
|
|
938
1051
|
→ Optional quick session rating
|
|
939
1052
|
|
|
940
1053
|
Next morning:
|
|
1054
|
+
$ aman-agent dev # in any project
|
|
1055
|
+
→ CLAUDE.md auto-updates if new memories exist
|
|
941
1056
|
→ Everything picks up where you left off
|
|
942
1057
|
```
|
|
943
1058
|
|
|
@@ -1237,6 +1352,20 @@ sequenceDiagram
|
|
|
1237
1352
|
|
|
1238
1353
|
## Commands
|
|
1239
1354
|
|
|
1355
|
+
### CLI Commands
|
|
1356
|
+
|
|
1357
|
+
| Command | Description |
|
|
1358
|
+
|:---|:---|
|
|
1359
|
+
| `aman-agent` | Start interactive chat session |
|
|
1360
|
+
| `aman-agent dev [path]` | Scan project, generate CLAUDE.md, launch Claude Code `[--smart\|--no-launch\|--force\|--diff]` |
|
|
1361
|
+
| `aman-agent init` | Set up your AI companion with a guided wizard |
|
|
1362
|
+
| `aman-agent serve` | Run as a local MCP server for agent delegation `[--name\|--profile]` |
|
|
1363
|
+
| `aman-agent setup` | Full reconfiguration wizard |
|
|
1364
|
+
| `aman-agent update` | Self-update to latest version |
|
|
1365
|
+
| `aman-agent uninstall` | Clean removal of all data and config |
|
|
1366
|
+
|
|
1367
|
+
### Slash Commands (inside a session)
|
|
1368
|
+
|
|
1240
1369
|
| Command | Description |
|
|
1241
1370
|
|:---|:---|
|
|
1242
1371
|
| `/help` | Show available commands |
|
package/dist/delegate.js
CHANGED
|
@@ -9,22 +9,22 @@ var __export = (target, all) => {
|
|
|
9
9
|
};
|
|
10
10
|
|
|
11
11
|
// src/logger.ts
|
|
12
|
-
import
|
|
13
|
-
import
|
|
12
|
+
import fs4 from "fs";
|
|
13
|
+
import path4 from "path";
|
|
14
14
|
import os3 from "os";
|
|
15
15
|
function ensureDir() {
|
|
16
|
-
if (!
|
|
17
|
-
|
|
16
|
+
if (!fs4.existsSync(LOG_DIR)) {
|
|
17
|
+
fs4.mkdirSync(LOG_DIR, { recursive: true });
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
20
|
function maybeRotate() {
|
|
21
21
|
try {
|
|
22
|
-
if (!
|
|
23
|
-
const stat =
|
|
22
|
+
if (!fs4.existsSync(LOG_PATH)) return;
|
|
23
|
+
const stat = fs4.statSync(LOG_PATH);
|
|
24
24
|
if (stat.size >= MAX_LOG_SIZE) {
|
|
25
25
|
const backupPath = LOG_PATH + ".1";
|
|
26
|
-
if (
|
|
27
|
-
|
|
26
|
+
if (fs4.existsSync(backupPath)) fs4.unlinkSync(backupPath);
|
|
27
|
+
fs4.renameSync(LOG_PATH, backupPath);
|
|
28
28
|
}
|
|
29
29
|
} catch {
|
|
30
30
|
}
|
|
@@ -42,7 +42,7 @@ function write(level, module, message, data) {
|
|
|
42
42
|
if (data !== void 0) {
|
|
43
43
|
entry.data = data instanceof Error ? data.message : String(data);
|
|
44
44
|
}
|
|
45
|
-
|
|
45
|
+
fs4.appendFileSync(LOG_PATH, JSON.stringify(entry) + "\n");
|
|
46
46
|
} catch {
|
|
47
47
|
}
|
|
48
48
|
}
|
|
@@ -50,8 +50,8 @@ var LOG_DIR, LOG_PATH, MAX_LOG_SIZE, log;
|
|
|
50
50
|
var init_logger = __esm({
|
|
51
51
|
"src/logger.ts"() {
|
|
52
52
|
"use strict";
|
|
53
|
-
LOG_DIR =
|
|
54
|
-
LOG_PATH =
|
|
53
|
+
LOG_DIR = path4.join(os3.homedir(), ".aman-agent");
|
|
54
|
+
LOG_PATH = path4.join(LOG_DIR, "debug.log");
|
|
55
55
|
MAX_LOG_SIZE = 1048576;
|
|
56
56
|
log = {
|
|
57
57
|
debug: (module, message, data) => write("debug", module, message, data),
|
|
@@ -62,21 +62,21 @@ var init_logger = __esm({
|
|
|
62
62
|
});
|
|
63
63
|
|
|
64
64
|
// src/server/registry.ts
|
|
65
|
-
import
|
|
66
|
-
import
|
|
65
|
+
import fs11 from "fs/promises";
|
|
66
|
+
import path11 from "path";
|
|
67
67
|
import os9 from "os";
|
|
68
68
|
function amanAgentHome() {
|
|
69
|
-
return process.env.AMAN_AGENT_HOME ||
|
|
69
|
+
return process.env.AMAN_AGENT_HOME || path11.join(os9.homedir(), ".aman-agent");
|
|
70
70
|
}
|
|
71
71
|
function registryPath() {
|
|
72
|
-
return
|
|
72
|
+
return path11.join(amanAgentHome(), "registry.json");
|
|
73
73
|
}
|
|
74
74
|
async function ensureHome() {
|
|
75
|
-
await
|
|
75
|
+
await fs11.mkdir(amanAgentHome(), { recursive: true });
|
|
76
76
|
}
|
|
77
77
|
async function readRaw() {
|
|
78
78
|
try {
|
|
79
|
-
const buf = await
|
|
79
|
+
const buf = await fs11.readFile(registryPath(), "utf-8");
|
|
80
80
|
const parsed = JSON.parse(buf);
|
|
81
81
|
return Array.isArray(parsed) ? parsed : [];
|
|
82
82
|
} catch (err) {
|
|
@@ -90,10 +90,10 @@ async function readRaw() {
|
|
|
90
90
|
async function writeAtomic(entries) {
|
|
91
91
|
await ensureHome();
|
|
92
92
|
const tmp = registryPath() + ".tmp";
|
|
93
|
-
await
|
|
94
|
-
await
|
|
93
|
+
await fs11.writeFile(tmp, JSON.stringify(entries, null, 2), { mode: 384 });
|
|
94
|
+
await fs11.rename(tmp, registryPath());
|
|
95
95
|
try {
|
|
96
|
-
await
|
|
96
|
+
await fs11.chmod(registryPath(), 384);
|
|
97
97
|
} catch {
|
|
98
98
|
}
|
|
99
99
|
}
|
|
@@ -264,8 +264,8 @@ var init_delegate_remote = __esm({
|
|
|
264
264
|
import pc2 from "picocolors";
|
|
265
265
|
|
|
266
266
|
// src/prompt.ts
|
|
267
|
-
import
|
|
268
|
-
import
|
|
267
|
+
import fs3 from "fs";
|
|
268
|
+
import path3 from "path";
|
|
269
269
|
import os2 from "os";
|
|
270
270
|
|
|
271
271
|
// src/token-budget.ts
|
|
@@ -322,14 +322,26 @@ function buildBudgetedPrompt(components, maxTokens = 8e3) {
|
|
|
322
322
|
}
|
|
323
323
|
|
|
324
324
|
// src/user-identity.ts
|
|
325
|
+
import fs2 from "fs";
|
|
326
|
+
import path2 from "path";
|
|
327
|
+
|
|
328
|
+
// src/config.ts
|
|
325
329
|
import fs from "fs";
|
|
326
330
|
import path from "path";
|
|
327
331
|
import os from "os";
|
|
328
|
-
|
|
332
|
+
function homeDir() {
|
|
333
|
+
return process.env.AMAN_HOME || process.env.AMAN_AGENT_HOME || path.join(os.homedir(), ".aman-agent");
|
|
334
|
+
}
|
|
335
|
+
function identityDir() {
|
|
336
|
+
return path.join(homeDir(), "identity");
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
// src/user-identity.ts
|
|
340
|
+
var USER_FILE = path2.join(identityDir(), "user.md");
|
|
329
341
|
function loadUserIdentity() {
|
|
330
|
-
if (!
|
|
342
|
+
if (!fs2.existsSync(USER_FILE)) return null;
|
|
331
343
|
try {
|
|
332
|
-
const content =
|
|
344
|
+
const content = fs2.readFileSync(USER_FILE, "utf-8");
|
|
333
345
|
const get = (key) => {
|
|
334
346
|
const match = content.match(new RegExp(`^- ${key}:\\s*(.+)$`, "m"));
|
|
335
347
|
return match?.[1]?.trim() ?? "";
|
|
@@ -419,19 +431,19 @@ var ECOSYSTEM_FILES = [
|
|
|
419
431
|
];
|
|
420
432
|
function resolveLayerPath(entry, home, profile) {
|
|
421
433
|
if (profile && entry.profileOverridable) {
|
|
422
|
-
const profilePath =
|
|
423
|
-
if (
|
|
434
|
+
const profilePath = path3.join(home, ".acore", "profiles", profile, entry.file);
|
|
435
|
+
if (fs3.existsSync(profilePath)) return profilePath;
|
|
424
436
|
if (entry.name === "guardrails") {
|
|
425
|
-
const altPath =
|
|
426
|
-
if (
|
|
437
|
+
const altPath = path3.join(home, ".acore", "profiles", profile, "rules.md");
|
|
438
|
+
if (fs3.existsSync(altPath)) return altPath;
|
|
427
439
|
}
|
|
428
440
|
if (entry.name === "skills") {
|
|
429
|
-
const altPath =
|
|
430
|
-
if (
|
|
441
|
+
const altPath = path3.join(home, ".acore", "profiles", profile, "skills.md");
|
|
442
|
+
if (fs3.existsSync(altPath)) return altPath;
|
|
431
443
|
}
|
|
432
444
|
}
|
|
433
|
-
const globalPath =
|
|
434
|
-
if (
|
|
445
|
+
const globalPath = path3.join(home, entry.dir, entry.file);
|
|
446
|
+
if (fs3.existsSync(globalPath)) return globalPath;
|
|
435
447
|
return null;
|
|
436
448
|
}
|
|
437
449
|
function assembleSystemPrompt(maxTokens, profile) {
|
|
@@ -440,7 +452,7 @@ function assembleSystemPrompt(maxTokens, profile) {
|
|
|
440
452
|
for (const entry of ECOSYSTEM_FILES) {
|
|
441
453
|
const filePath = resolveLayerPath(entry, home, profile);
|
|
442
454
|
if (filePath) {
|
|
443
|
-
const content =
|
|
455
|
+
const content = fs3.readFileSync(filePath, "utf-8").trim();
|
|
444
456
|
components.push({
|
|
445
457
|
name: entry.name,
|
|
446
458
|
content,
|
|
@@ -448,9 +460,9 @@ function assembleSystemPrompt(maxTokens, profile) {
|
|
|
448
460
|
});
|
|
449
461
|
}
|
|
450
462
|
}
|
|
451
|
-
const contextPath =
|
|
452
|
-
if (
|
|
453
|
-
const content =
|
|
463
|
+
const contextPath = path3.join(process.cwd(), ".acore", "context.md");
|
|
464
|
+
if (fs3.existsSync(contextPath)) {
|
|
465
|
+
const content = fs3.readFileSync(contextPath, "utf-8").trim();
|
|
454
466
|
components.push({
|
|
455
467
|
name: "context",
|
|
456
468
|
content,
|
|
@@ -502,8 +514,8 @@ init_logger();
|
|
|
502
514
|
init_logger();
|
|
503
515
|
import pc from "picocolors";
|
|
504
516
|
import * as p from "@clack/prompts";
|
|
505
|
-
import
|
|
506
|
-
import
|
|
517
|
+
import fs10 from "fs";
|
|
518
|
+
import path10 from "path";
|
|
507
519
|
import os8 from "os";
|
|
508
520
|
|
|
509
521
|
// src/personality.ts
|
|
@@ -534,9 +546,9 @@ import {
|
|
|
534
546
|
importFromTeam,
|
|
535
547
|
syncToCopilot
|
|
536
548
|
} from "@aman_asmuei/amem-core";
|
|
537
|
-
import
|
|
549
|
+
import path5 from "path";
|
|
538
550
|
import os4 from "os";
|
|
539
|
-
import
|
|
551
|
+
import fs5 from "fs";
|
|
540
552
|
var db = null;
|
|
541
553
|
var currentProject = "global";
|
|
542
554
|
function getDb() {
|
|
@@ -557,13 +569,13 @@ async function memoryRecall(query, opts) {
|
|
|
557
569
|
}
|
|
558
570
|
|
|
559
571
|
// src/postmortem.ts
|
|
560
|
-
import
|
|
561
|
-
import
|
|
572
|
+
import fs7 from "fs/promises";
|
|
573
|
+
import path7 from "path";
|
|
562
574
|
import os6 from "os";
|
|
563
575
|
|
|
564
576
|
// src/observation.ts
|
|
565
|
-
import
|
|
566
|
-
import
|
|
577
|
+
import fs6 from "fs/promises";
|
|
578
|
+
import path6 from "path";
|
|
567
579
|
import os5 from "os";
|
|
568
580
|
|
|
569
581
|
// src/postmortem.ts
|
|
@@ -571,12 +583,12 @@ init_logger();
|
|
|
571
583
|
|
|
572
584
|
// src/crystallization.ts
|
|
573
585
|
init_logger();
|
|
574
|
-
import fs7 from "fs/promises";
|
|
575
|
-
import path7 from "path";
|
|
576
|
-
|
|
577
|
-
// src/user-model.ts
|
|
578
586
|
import fs8 from "fs/promises";
|
|
579
587
|
import path8 from "path";
|
|
588
|
+
|
|
589
|
+
// src/user-model.ts
|
|
590
|
+
import fs9 from "fs/promises";
|
|
591
|
+
import path9 from "path";
|
|
580
592
|
import os7 from "os";
|
|
581
593
|
|
|
582
594
|
// src/hooks.ts
|