@aikaara/pikaara 0.0.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 +118 -0
- package/native/darwin/prebuilds/darwin-arm64/darwin-platform.node +0 -0
- package/native/darwin/prebuilds/darwin-x64/darwin-platform.node +0 -0
- package/native/linux/prebuilds/linux-arm64/linux-platform-x11.node +0 -0
- package/native/linux/prebuilds/linux-x64/linux-platform-x11.node +0 -0
- package/native/win32/prebuilds/win32-arm64/win32-platform.node +0 -0
- package/native/win32/prebuilds/win32-x64/win32-platform.node +0 -0
- package/package.json +43 -0
- package/pikaara.mjs +137135 -0
package/README.md
ADDED
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
# pikaara
|
|
2
|
+
|
|
3
|
+
Jev-centric coding-agent harness. Design source: `Coding_harness_plan/Jev-Engineering-for-Coding-Agents.pdf`.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install -g @aikaara/pikaara # Node >= 22.19; installs the `pikaara` command
|
|
9
|
+
pikaara --version
|
|
10
|
+
pikaara # interactive; `pikaara -p "<prompt>"` for one-shot
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Layout (npm workspaces, `@pikaara/*`)
|
|
14
|
+
|
|
15
|
+
| Package | Paper section | Role |
|
|
16
|
+
|---|---|---|
|
|
17
|
+
| `jev` | I.A, Table I | Decision-layer contract: typed questions → choice / ranked / score / noul + probability; `withFallback` |
|
|
18
|
+
| `classify` | I.A, Fig. 1 | **Core.** Our TypeSafe System One client (native, OpenRouter, Cloudflare) and the classifier Jev that answers every decision point, batching same-tick questions into one request |
|
|
19
|
+
| `state` | Fig. 1 | Addressable, typed chunk store. Supersede, never delete; `onChange`/`restore` for persistence |
|
|
20
|
+
| `durable` | II.E (restarts), VI.A | Our port of pi-durable: global IDs, atomic seq-numbered commits, chunks alive over `[createdAt, retiredAt)` (history + fork-aware reads), memory / crash-safe JSONL / SQLite (`node:sqlite`, WAL) storage, op-by-op documents (`diff`/`apply`, history at any seq), crash-resumable `TaskScheduler`, serialized `Session`, storage conformance suite (`@pikaara/durable/testing`) |
|
|
21
|
+
| `context` | V, VIII | Visibility ladder per query; conditional instructions |
|
|
22
|
+
| `tools` | IV.B, VII | Tiered disclosure (snippet / schema / docs); intent → tool routing |
|
|
23
|
+
| `permissions` | IV.A | Programmable allow / ask / deny policies |
|
|
24
|
+
| `router` | II.A, IX | Cost per context rebuild; data-sensitivity routing |
|
|
25
|
+
| `runtime` | Fig. 1 | The loop wiring all of the above |
|
|
26
|
+
| `ai` | Fig. 1 (LLMs) | pi-ai adapters: any-provider `ModelClient`, `discover()` (auth + subscription checks → `ModelInfo`), locked `FileCredentialStore` (`~/.pikaara/auth.json`), `createJev(spec)` (credential glue for classify) |
|
|
27
|
+
| `swarm` | VI, VI.A, VI.B, X | Sub-agents: `task` tool, Jev-built per-goal context + toolsets, goal dedup (exact + Jev `duplicate`), per-path RW locks + write-claim admission, durable `TaskScheduler` tasks |
|
|
28
|
+
| `coding-agent` | — | `pikaara` CLI: interactive TUI (pi-tui) + print mode, built-in tools (read/bash/edit/write/grep/find/ls, ported from pi), system prompt + AGENTS.md/CLAUDE.md discovery |
|
|
29
|
+
|
|
30
|
+
Dependency direction: `durable` standalone; `jev` ← `classify`; `jev` ← `state` ← `context`; `jev` ← `tools|permissions|router`; all ← `runtime` ← `ai` ← `coding-agent`. External: `@earendil-works/pi-ai` (npm, pinned). No cycles (`scripts/build.mjs` enforces).
|
|
31
|
+
|
|
32
|
+
## Rules
|
|
33
|
+
|
|
34
|
+
- ESM, TS 7, `erasableSyntaxOnly`: no enums, namespaces, or constructor parameter properties.
|
|
35
|
+
- Relative imports use `.ts` extensions (rewritten on build).
|
|
36
|
+
- Workspace imports resolve to `src/` via the `source` export condition (typecheck, vitest, `npm run dev`); builds use `dist/`.
|
|
37
|
+
- Every decision the harness makes per turn is a `jev.ask(point, input)` with a typed answer — don't branch on prose.
|
|
38
|
+
- Format: tabs, width 120 (biome). Run `npm run check` before committing.
|
|
39
|
+
|
|
40
|
+
## Jev (core)
|
|
41
|
+
|
|
42
|
+
- Every per-turn decision (context visibility, cache, routing, tools, permissions, security) is a `jev.ask()` answered by the classifier Jev in `@pikaara/classify` — never pi-ai's classify.
|
|
43
|
+
- Model is user-chosen: `--jev <provider/model>` or `PIKAARA_JEV`; default `typesafe/jev-latest`. Hosts: `typesafe` (TYPESAFE_API_KEY / `pikaara login typesafe`), `openrouter` (key or OAuth), `cloudflare-workers-ai`.
|
|
44
|
+
- `pikaara jev` shows the active config; `pikaara jev set [provider/model] [--base-url]` saves it to `~/.pikaara/settings.json` for all sessions (interactive without args; prompts for a TypeSafe key if missing); `pikaara jev test` probes it; `pikaara jev reset`. Precedence: `--jev` > `PIKAARA_JEV` > settings > default.
|
|
45
|
+
- On Jev failure the agent falls back to the rule baseline per decision and warns once.
|
|
46
|
+
|
|
47
|
+
## Using pikaara
|
|
48
|
+
|
|
49
|
+
- `pikaara` (TTY) opens the interactive agent; `pikaara "<prompt>"` / `pikaara -p "<prompt>"` runs once and prints (`--yes` auto-approves). `-c` resumes, `-m provider/id` pins the brain, `-j` picks Jev.
|
|
50
|
+
- Keys: enter submit · shift+enter newline · esc interrupt · ctrl+c clear, twice to exit · ctrl+d exit · ctrl+o expand tool output · ↑ history.
|
|
51
|
+
- Commands: `/model [id|auto]`, `/jev`, `/session`, `/new`, `/help`, `/quit`; `!cmd` runs a shell command yourself (output enters context).
|
|
52
|
+
- Approvals: writes outside the repo and commands no rule/Jev clears are asked inline (Yes / Yes for session / No). Secrets (`~/.ssh`, `.env*`) are denied.
|
|
53
|
+
- The current request's own chunks are always shown in full; Jev decides visibility for older ones.
|
|
54
|
+
- `PIKAARA_DEBUG_FILE=path` appends every model request (JSON) for debugging.
|
|
55
|
+
|
|
56
|
+
## Jev coverage of the paper (all rows implemented)
|
|
57
|
+
|
|
58
|
+
- Prompt caching is on by default (`PIKAARA_CACHE=none|short|long`). The system prompt, tools and one content block per chunk form a stable prefix: Jev decides reuse vs rebuild once per request, later turns keep every earlier chunk's visibility, and the disclosed tool set is fixed per request. Measured on a 6-turn task: 49.9k of 58k prompt tokens served from cache, cost −71%. Print mode reports `cache read/write` on stderr; the footer shows `R…`.
|
|
59
|
+
- Brain: default `auto` — Jev routes each turn across your subscription models and paid frontier models from gateways (OpenRouter; labs behind a gateway count as `vetted`, underlying vendor used). The shortlist keeps the best flat-rate and cheapest metered model per tier (frontier/mid/small); Jev sees cost + tier. `/model <id>` pins, `/model auto` restores.
|
|
60
|
+
- Routing: models narrowed by data sensitivity (file rules ∪ Jev security score; settings `routing.sensitivity` / `routing.excludeVendors`), then Jev picks with per-candidate turn cost (`turnCost`: rebuild + generation).
|
|
61
|
+
- `act` (paper IV.B): the model states an intent; Jev picks the tool, a small helper model (subscription haiku or cheapest capable; `brain.helper`) builds arguments from a tiny context, Jev fills enum/boolean fields as typed choices, schema validation with one repair round.
|
|
62
|
+
- Headroom (XI): large chunks shown compressed are checked by Jev (`sufficient`); if facts the query needs were lost, the next rung is shown.
|
|
63
|
+
- Micro-worlds (X): `simulate` dry-runs a command in a copy-on-write clone of the repo and reports created/modified/deleted files.
|
|
64
|
+
- Evals (X): every request is recorded in `evals.jsonl`; `background.shadowModel` mirrors the final turn to a candidate model and Jev (`equivalent`) judges it — `/evals`, `pikaara evals`.
|
|
65
|
+
- Tools: core tools always carry schemas; Jev discloses a few more per request; `load_tools` reaches the rest. Args are schema-validated; unknown tool names are routed by Jev to the right tool.
|
|
66
|
+
- Ladder: large chunks get summaries at creation; `long` shows query-relevant lines (heatmap) when they exist.
|
|
67
|
+
- Permissions: scripts a command runs (`python x.py`, `./x.sh`) are read before policy/Jev decide.
|
|
68
|
+
- Conditional instructions: subdirectory AGENTS.md/FOOTGUNS.md and `.pikaara/instructions/*.md` (frontmatter `paths`/`keywords`) load only when relevant; skills (`.pikaara/skills/<name>/SKILL.md`, `~/.pikaara/skills`, built-in `eli5`) attach/detach with conditions and may add `allow` globs while active.
|
|
69
|
+
- Variables: `vars` tool, durable per-conversation document, pinned each turn.
|
|
70
|
+
- Background: shared retrieval per request (grep + identifiers + Jev), `/review` and `background.review` cross-model review, live `progress.html`, token accounting (`/stats`, `pikaara stats`).
|
|
71
|
+
- Batteries: `outline` (symbols / one symbol's body), `ast_grep` (if installed), repetitive-output compression in `bash`, frequency-ranked `find`.
|
|
72
|
+
|
|
73
|
+
## Benchmarks
|
|
74
|
+
|
|
75
|
+
- `npm run bundle` → `dist-bundle/pikaara.mjs` (single file, Node ≥ 22.19).
|
|
76
|
+
- Terminal-Bench via Harbor: `bench/terminal-bench/run.sh` (adapter `bench/terminal-bench/pikaara_agent.py`); needs Docker or `-e modal`.
|
|
77
|
+
|
|
78
|
+
## Sub-agents and CLI tools
|
|
79
|
+
|
|
80
|
+
- The main agent has a `task` tool: many subgoals at once, each a durable sub-agent with context selected by Jev from the parent's chunks and a Jev-ranked toolset. `access: "read"` (default) never contends and gets a read-only command policy; `access: "write"` + `files` claims serialize only overlapping edits (undeclared writes serialize with all writes). File tools take per-path read/write locks. Duplicate goals reuse earlier results. Sub-agents can't spawn sub-agents; approvals are queued one at a time.
|
|
81
|
+
- Concurrency: `PIKAARA_SUBAGENTS` or `settings.json` `subagents.concurrency` (default 8), cap `subagents.maxTasks` (default 500). Unfinished sub-agents from a previous process are aborted (resumed with `-c`).
|
|
82
|
+
- Any installed CLI is usable: `cli_search` (PATH discovery, Jev-ranked) → `cli_help` (--help/man on demand) → `bash`.
|
|
83
|
+
- Permissions: `settings.json` `permissions.{allow,ask,deny}` globs over the whole command (deny > ask > allow, before defaults). The approval prompt's "Always allow" saves the exact command there.
|
|
84
|
+
|
|
85
|
+
## Telemetry
|
|
86
|
+
|
|
87
|
+
- Every run appends JSONL events to `~/.pikaara/sessions/<dir>/telemetry.jsonl` (`PIKAARA_TELEMETRY_FILE` overrides, `PIKAARA_TELEMETRY=0` disables): Jev decisions per turn, model calls (duration, tokens, cache, cost), tool calls (duration, ok, preview), permissions, fan-out/verify, background joins, sub-agent lifecycle.
|
|
88
|
+
- `pikaara telemetry [paths] [-o report.html] [--open]` renders a self-contained dashboard (sessions and Terminal-Bench job dirs): stat tiles, per-task table, per-task timeline (model/tool/sub-agent lanes with hover detail), Jev decisions per turn, event log, tool usage, cost per task, token mix. `--trace` / `watch.py` give the live view.
|
|
89
|
+
|
|
90
|
+
## Sessions
|
|
91
|
+
|
|
92
|
+
- Every run persists its chunk store to `~/.pikaara/sessions/<dir>-<hash>/session.db` (SQLite; `main.jsonl` with `PIKAARA_STORAGE=jsonl`) (one commit per chunk change). `pikaara -c "<prompt>"` resumes the latest session for the cwd.
|
|
93
|
+
|
|
94
|
+
## Auth
|
|
95
|
+
|
|
96
|
+
- `pikaara login [provider] [--api-key]` — OAuth by default where offered; credentials in `~/.pikaara/auth.json` (0600, file-locked; `PIKAARA_DIR` overrides).
|
|
97
|
+
- `pikaara auth [--all] [--refresh]` — per-provider status; `*` = subscription OAuth.
|
|
98
|
+
- Subscription-backed models (Claude Pro/Max, ChatGPT Codex, Copilot, ...) have `subscription: true`; the router prices them at 0 marginal cost.
|
|
99
|
+
- Env keys are used only when no credential is stored for that provider.
|
|
100
|
+
|
|
101
|
+
## Dev
|
|
102
|
+
|
|
103
|
+
- `.env` (gitignored; template `.env.example`) is loaded only by dev scripts. `LOCAL_<NAME>` maps to `<NAME>` (`scripts/dev-env.mjs`); with an OpenRouter key Jev defaults to `openrouter/typesafe/jev-1.13`.
|
|
104
|
+
- Sessions are stored in SQLite (`session.db`) by default; `PIKAARA_STORAGE=jsonl` switches to JSONL. Legacy JSONL-only session dirs stay on JSONL so `-c` still resumes them.
|
|
105
|
+
|
|
106
|
+
## Commands
|
|
107
|
+
|
|
108
|
+
- `npm run check` — biome + typecheck
|
|
109
|
+
- `npm test` — vitest across all packages (against source)
|
|
110
|
+
- `npm run build` — topological `tsc` builds
|
|
111
|
+
- `npm run build:watch` — build, then `tsc --watch` every package
|
|
112
|
+
- `npm run dev -- "<prompt>"` — run the CLI from source (`-m provider/id`, `--list-models`)
|
|
113
|
+
- `npm run dev:watch -- "<prompt>"` — same, rerun on source change
|
|
114
|
+
- `npm run dev:jev` — probe the configured Jev
|
|
115
|
+
- `npm run link` — build + `npm link` the `pikaara` bin globally; `npm run dev:link` = link + watch build (global `pikaara` picks up every rebuild); `npm run unlink`
|
|
116
|
+
- `npm run bench -- [harbor args]` — Terminal-Bench run with a realtime dashboard URL; `npm run bench:dashboard` to attach; `npm run bench:report` compares runs
|
|
117
|
+
- `npm run pack:npm` — bundle + assemble the publishable `@aikaara/pikaara` package in `dist-npm/`. Publishing: push a `vX.Y.Z` tag (or run the "npm publish" workflow; dry run by default) → `.github/workflows/npm-publish.yml` lints, tests, bundles, installs it globally on Linux/macOS/Windows and publishes with provenance (secret `NPM_TOKEN` or npm trusted publishing)
|
|
118
|
+
- `node scripts/new-package.mjs <dir> "<desc>" [deps...]` — scaffold a package
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/package.json
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@aikaara/pikaara",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "pikaara: aikaara coding agent — a Jev-centric harness",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"pikaara",
|
|
7
|
+
"coding-agent",
|
|
8
|
+
"ai",
|
|
9
|
+
"agent",
|
|
10
|
+
"cli",
|
|
11
|
+
"llm",
|
|
12
|
+
"jev",
|
|
13
|
+
"terminal",
|
|
14
|
+
"aikaara"
|
|
15
|
+
],
|
|
16
|
+
"license": "ISC",
|
|
17
|
+
"author": "vinayak iyer (vinayak@aikaara.com)",
|
|
18
|
+
"homepage": "https://github.com/aikaara/pikaara#readme",
|
|
19
|
+
"repository": {
|
|
20
|
+
"type": "git",
|
|
21
|
+
"url": "git+https://github.com/aikaara/pikaara.git"
|
|
22
|
+
},
|
|
23
|
+
"bugs": {
|
|
24
|
+
"url": "https://github.com/aikaara/pikaara/issues"
|
|
25
|
+
},
|
|
26
|
+
"type": "module",
|
|
27
|
+
"bin": {
|
|
28
|
+
"pikaara": "pikaara.mjs"
|
|
29
|
+
},
|
|
30
|
+
"files": [
|
|
31
|
+
"pikaara.mjs",
|
|
32
|
+
"native",
|
|
33
|
+
"README.md",
|
|
34
|
+
"LICENSE",
|
|
35
|
+
"LICENSE.md"
|
|
36
|
+
],
|
|
37
|
+
"engines": {
|
|
38
|
+
"node": ">=22.19.0"
|
|
39
|
+
},
|
|
40
|
+
"publishConfig": {
|
|
41
|
+
"access": "public"
|
|
42
|
+
}
|
|
43
|
+
}
|