@heyamiko/amiko-cli 0.4.1 → 0.4.8
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/PLAN.md +113 -0
- package/bun.lock +596 -0
- package/dist/agent/piAgent.js +239 -0
- package/dist/agent/tools.js +149 -0
- package/dist/app.js +355 -0
- package/dist/cli.js +83 -0
- package/dist/commands.js +22 -0
- package/dist/components/ModelPicker.js +63 -0
- package/dist/config.js +26 -0
- package/dist/configFile.js +23 -0
- package/dist/memory/qmd.js +87 -0
- package/dist/prompt.js +43 -0
- package/dist/session.js +26 -0
- package/dist/types.js +1 -0
- package/dist/workspace.js +42 -0
- package/package.json +16 -27
- package/src/agent/piAgent.ts +266 -0
- package/src/agent/tools.ts +153 -0
- package/src/app.tsx +448 -0
- package/src/cli.tsx +100 -0
- package/src/commands.ts +39 -0
- package/src/components/ModelPicker.tsx +107 -0
- package/src/config.ts +31 -0
- package/src/configFile.ts +33 -0
- package/src/memory/qmd.ts +111 -0
- package/src/prompt.ts +55 -0
- package/src/session.ts +35 -0
- package/src/types.ts +40 -0
- package/src/workspace.ts +58 -0
- package/tsconfig.json +16 -0
- package/README.md +0 -222
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -67576
package/PLAN.md
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
# Amiko CLI Agent Plan
|
|
2
|
+
|
|
3
|
+
## Goals
|
|
4
|
+
- Build a TypeScript CLI agent for Amiko.
|
|
5
|
+
- Use `@mariozechner/pi-coding-agent` as the agent backend.
|
|
6
|
+
- Use QMD (`qmd`) for memory search/retrieval.
|
|
7
|
+
- Use Ink for the TUI.
|
|
8
|
+
- Maintain a workspace folder with persistent memory files and per-session logs.
|
|
9
|
+
|
|
10
|
+
## Non-Goals (for this phase)
|
|
11
|
+
- Implement additional chat channels (WhatsApp/Telegram/etc.).
|
|
12
|
+
- Build a separate daemon or multi-client gateway unless required later.
|
|
13
|
+
- Ship packaged binaries or installers.
|
|
14
|
+
|
|
15
|
+
## Reference Architecture (Moltbot-inspired)
|
|
16
|
+
Moltbot’s architecture separates a long-lived Gateway (control plane) from clients that connect over a single transport (WebSocket), and keeps the Gateway as the only process that owns external integrations. We’ll mirror this separation in a CLI-friendly way:
|
|
17
|
+
|
|
18
|
+
1) **Client/UI** (Ink TUI)
|
|
19
|
+
2) **Agent Runtime** (pi-coding-agent adapter)
|
|
20
|
+
3) **Workspace + Memory** (local files + QMD search)
|
|
21
|
+
|
|
22
|
+
For this initial CLI-only scope, all three can run in a single process. The boundary will be maintained in code so we can later split into a Gateway daemon + multiple clients if needed.
|
|
23
|
+
|
|
24
|
+
## Workspace Layout (local-first memory)
|
|
25
|
+
Workspace root: user-configurable (default: `~/.amiko` or project-provided path)
|
|
26
|
+
|
|
27
|
+
```
|
|
28
|
+
workspace/
|
|
29
|
+
IDENTITY.md
|
|
30
|
+
PERSONALITY.md
|
|
31
|
+
MEMORY.md
|
|
32
|
+
sessions/
|
|
33
|
+
yyyy-mm-dd-<id>.md
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Rules:
|
|
37
|
+
- `IDENTITY.md`: stable identity and role.
|
|
38
|
+
- `PERSONALITY.md`: tone, style, and behavior defaults.
|
|
39
|
+
- `MEMORY.md`: long-term memory (summaries, facts, preferences).
|
|
40
|
+
- `sessions/yyyy-mm-dd-id.md`: per-session transcript/memory log.
|
|
41
|
+
|
|
42
|
+
## Components
|
|
43
|
+
|
|
44
|
+
### 1) CLI + TUI (Ink)
|
|
45
|
+
- Interactive chat UI with streaming output and status panes.
|
|
46
|
+
- Commands: `/exit`, `/help`, `/memory`, `/session`, `/search`, `/plan` (minimal set).
|
|
47
|
+
- Visual status: model, workspace path, memory hits, active tools.
|
|
48
|
+
|
|
49
|
+
### 2) Agent Backend Adapter (pi-coding-agent)
|
|
50
|
+
- Wrap pi-coding-agent to expose a stable API for:
|
|
51
|
+
- send user message
|
|
52
|
+
- stream assistant output
|
|
53
|
+
- tool invocation
|
|
54
|
+
- interrupts/cancel
|
|
55
|
+
- Keep backend configurable (model, provider, temperature, etc.).
|
|
56
|
+
|
|
57
|
+
### 3) Memory & Retrieval (QMD)
|
|
58
|
+
- Treat QMD as an external CLI tool.
|
|
59
|
+
- Index the workspace and any configured additional folders.
|
|
60
|
+
- Retrieval pipeline:
|
|
61
|
+
1) On each user query, run `qmd query` (hybrid + rerank) over workspace.
|
|
62
|
+
2) Pull top N snippets or full docs with `qmd get`.
|
|
63
|
+
3) Inject memory context into the agent prompt.
|
|
64
|
+
- Provide a `/search <query>` command to show memory hits.
|
|
65
|
+
|
|
66
|
+
### 4) Session Persistence
|
|
67
|
+
- Append every user/assistant turn to `sessions/yyyy-mm-dd-id.md`.
|
|
68
|
+
- Periodically summarize into `MEMORY.md` (manual for v1, automated later).
|
|
69
|
+
|
|
70
|
+
## Data Flow (per message)
|
|
71
|
+
1) User enters message in Ink UI.
|
|
72
|
+
2) Memory search with QMD (optional based on size + settings).
|
|
73
|
+
3) Build prompt from:
|
|
74
|
+
- IDENTITY.md
|
|
75
|
+
- PERSONALITY.md
|
|
76
|
+
- MEMORY.md (summary)
|
|
77
|
+
- Retrieved session/memory snippets
|
|
78
|
+
4) Send to pi-coding-agent.
|
|
79
|
+
5) Stream output to UI.
|
|
80
|
+
6) Persist to session file; optional memory rollup.
|
|
81
|
+
|
|
82
|
+
## Implementation Milestones
|
|
83
|
+
|
|
84
|
+
### Milestone 1: Skeleton + Workspace
|
|
85
|
+
- Initialize TS project with Ink.
|
|
86
|
+
- Create workspace loader + validator.
|
|
87
|
+
- Create session file writer.
|
|
88
|
+
|
|
89
|
+
### Milestone 2: Agent Backend Integration
|
|
90
|
+
- Adapter around pi-coding-agent.
|
|
91
|
+
- Streaming to UI.
|
|
92
|
+
- Basic command handling.
|
|
93
|
+
|
|
94
|
+
### Milestone 3: QMD Memory Search
|
|
95
|
+
- Integrate QMD CLI calls.
|
|
96
|
+
- Add `/search` command.
|
|
97
|
+
- Inject memory hits into prompts.
|
|
98
|
+
|
|
99
|
+
### Milestone 4: Polishing
|
|
100
|
+
- Config file handling.
|
|
101
|
+
- Better errors/logging.
|
|
102
|
+
- Memory rollup helpers.
|
|
103
|
+
|
|
104
|
+
## Risks / Open Questions
|
|
105
|
+
- QMD install/availability assumptions (global `qmd` binary).
|
|
106
|
+
- Whether pi-coding-agent provides a clean streaming API for Ink.
|
|
107
|
+
- Prompt size and memory insertion strategy.
|
|
108
|
+
|
|
109
|
+
## Success Criteria
|
|
110
|
+
- CLI runs with Ink UI.
|
|
111
|
+
- Sends prompts through pi-coding-agent.
|
|
112
|
+
- Uses QMD to retrieve memory snippets.
|
|
113
|
+
- Writes long-term and per-session memory files.
|