@gamaze/hicortex 0.19.6 → 0.20.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 +8 -4
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +8 -1
- package/dist/consolidate.d.ts +21 -0
- package/dist/consolidate.js +68 -8
- package/dist/dashboard.js +5 -2
- package/dist/identity-store.d.ts +3 -3
- package/dist/identity-store.js +2 -2
- package/dist/init.d.ts +10 -1
- package/dist/init.js +210 -22
- package/dist/llm-flight.d.ts +30 -0
- package/dist/llm-flight.js +190 -0
- package/dist/llm.d.ts +32 -0
- package/dist/llm.js +69 -2
- package/dist/nightly.d.ts +41 -0
- package/dist/nightly.js +92 -5
- package/dist/opencode-transcript-reader.d.ts +63 -0
- package/dist/opencode-transcript-reader.js +181 -0
- package/dist/status.js +23 -0
- package/dist/telemetry.d.ts +5 -5
- package/dist/telemetry.js +5 -5
- package/dist/uninstall.js +34 -0
- package/hermes-plugin/hicortex/README.md +2 -2
- package/hermes-plugin/hicortex/config.py +17 -56
- package/hermes-plugin/hicortex/plugin.yaml +2 -2
- package/hermes-plugin/hicortex/provider.py +4 -1
- package/opencode-plugin/hicortex/index.ts +981 -0
- package/package.json +6 -4
- package/pi-extension/hicortex/README.md +56 -0
- package/pi-extension/hicortex/index.ts +888 -0
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gamaze/hicortex",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Persistent agent identity for AI agents \u2014 a hand-edited identity layer, nightly-distilled experience, and lessons injected every session, shared across your whole fleet. Works with Hermes, OpenClaw, Claude Code, and
|
|
3
|
+
"version": "0.20.1",
|
|
4
|
+
"description": "Persistent agent identity for AI agents \u2014 a hand-edited identity layer, nightly-distilled experience, and lessons injected every session, shared across your whole fleet. Works with Hermes, OpenClaw, Claude Code, Pi, and opencode.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"bin": {
|
|
7
7
|
"hicortex": "dist/cli.js"
|
|
@@ -28,6 +28,8 @@
|
|
|
28
28
|
"assets/",
|
|
29
29
|
"skills/",
|
|
30
30
|
"hermes-plugin/",
|
|
31
|
+
"pi-extension/",
|
|
32
|
+
"opencode-plugin/",
|
|
31
33
|
"openclaw.plugin.json",
|
|
32
34
|
"domains.example.json",
|
|
33
35
|
"README.md",
|
|
@@ -40,8 +42,8 @@
|
|
|
40
42
|
"eval": "node dist/eval/run-eval.js",
|
|
41
43
|
"eval:recall-sweep": "node dist/eval/recall-sweep.js",
|
|
42
44
|
"eval:relevance": "node dist/eval/relevance-eval.js",
|
|
43
|
-
"prepack": "npm run build && rm -rf ./hermes-plugin && mkdir -p ./hermes-plugin && cp -r ../../hermes-plugin/hicortex ./hermes-plugin/ && find ./hermes-plugin -name __pycache__ -type d -exec rm -rf {} + 2>/dev/null || true",
|
|
44
|
-
"prepublishOnly": "npm run build && rm -rf ./hermes-plugin && mkdir -p ./hermes-plugin && cp -r ../../hermes-plugin/hicortex ./hermes-plugin/ && find ./hermes-plugin -name __pycache__ -type d -exec rm -rf {} + 2>/dev/null || true"
|
|
45
|
+
"prepack": "npm run build && rm -rf ./hermes-plugin && mkdir -p ./hermes-plugin && cp -r ../../hermes-plugin/hicortex ./hermes-plugin/ && find ./hermes-plugin -name __pycache__ -type d -exec rm -rf {} + 2>/dev/null || true && rm -rf ./pi-extension && mkdir -p ./pi-extension && cp -r ../../pi-extension/hicortex ./pi-extension/ && rm -rf ./opencode-plugin && mkdir -p ./opencode-plugin && cp -r ../../opencode-plugin/hicortex ./opencode-plugin/",
|
|
46
|
+
"prepublishOnly": "npm run build && rm -rf ./hermes-plugin && mkdir -p ./hermes-plugin && cp -r ../../hermes-plugin/hicortex ./hermes-plugin/ && find ./hermes-plugin -name __pycache__ -type d -exec rm -rf {} + 2>/dev/null || true && rm -rf ./pi-extension && mkdir -p ./pi-extension && cp -r ../../pi-extension/hicortex ./pi-extension/ && rm -rf ./opencode-plugin && mkdir -p ./opencode-plugin && cp -r ../../opencode-plugin/hicortex ./opencode-plugin/"
|
|
45
47
|
},
|
|
46
48
|
"devDependencies": {
|
|
47
49
|
"@types/better-sqlite3": "^7.6.0",
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# Hicortex memory extension for Pi
|
|
2
|
+
|
|
3
|
+
> **Install:** `npx @gamaze/hicortex init` auto-detects `~/.pi/agent/` and copies this file to `~/.pi/agent/extensions/hicortex.ts`. Manual: copy `pi-extension/hicortex/index.ts` there yourself. Requires a running [Hicortex](https://hicortex.gamaze.com/) server (local or remote); configure it with `npx @gamaze/hicortex init` on that machine.
|
|
4
|
+
|
|
5
|
+
Gives [Pi](https://pi.dev) agents self-learning memory backed by a Hicortex server — the same experience as the Claude Code / OpenClaw clients: **pushed recall on every prompt**, the identity layer + distilled Learnings in the system prompt at session start, and the nine memory tools. It is **dependency-free** (Node built-ins only, no npm packages, no imports from the Hicortex package) and **recall-only** — capture of Pi sessions is handled by the server machine's nightly job, which distills `~/.pi/agent/sessions/`.
|
|
6
|
+
|
|
7
|
+
**Fail-soft everywhere.** Any failure — no config, server down, timeout, non-2xx, parse error — injects nothing and never blocks or crashes a session. Every injection-path fetch has a 1-second timeout (tool fetches: 10 s). There are no terminal-UI calls, so non-interactive `pi -p` runs are safe by construction.
|
|
8
|
+
|
|
9
|
+
## How it works
|
|
10
|
+
|
|
11
|
+
| Pi hook | What it does | Hicortex call |
|
|
12
|
+
|---|---|---|
|
|
13
|
+
| `before_agent_start` | pushed **recall index** each turn — injected as a custom message alongside the user prompt; the agent lazy-loads full content with `hicortex_get` | `POST /recall-index` |
|
|
14
|
+
| `before_agent_start` | identity + Learnings appended to the system prompt (re-applied every turn from a per-session cache — Pi resets a system-prompt override to base whenever no extension returns one) | `GET /identity`, `GET /learnings` |
|
|
15
|
+
| `session_start` | reset the session's server-side recall dedup (fresh context window); drop cached blocks | `POST /recall-index` `{reset: true}` |
|
|
16
|
+
| `session_compact` | same reset + cache drop — the rebuilt window may have lost the injected blocks | `POST /recall-index` `{reset: true}` |
|
|
17
|
+
| `pi.registerTool` × 9 | the unified tools as direct REST proxies | see tool table below |
|
|
18
|
+
|
|
19
|
+
### Pushed recall index
|
|
20
|
+
|
|
21
|
+
Each user prompt is POSTed to the server's `/recall-index`; the returned **index block** (one line per relevant memory: id, title, date) is injected into the turn. All gating and dedup knobs (`recallMaxItems`, `recallMinSimilarity`, `recallReshowTurns`, …) live in the **server** config — the extension carries none. A dedup reset fired at session start is awaited by the first turn's recall POST, so it can never land after it and wipe the turn state.
|
|
22
|
+
|
|
23
|
+
### Identity layer
|
|
24
|
+
|
|
25
|
+
The hand-edited identity layer ("who you are + how to work") is injected as a `## Identity` block **only when the server's `identityClients` list includes `"pi"`** (it does under `"all"`; default is `["cc"]`). Global identity only — no per-agent scoping (`?agent=`), matching Claude Code's default.
|
|
26
|
+
|
|
27
|
+
### Tools (unified 9)
|
|
28
|
+
|
|
29
|
+
| Tool | REST call | Description |
|
|
30
|
+
|---|---|---|
|
|
31
|
+
| `hicortex_search` | `GET /search` | Semantic search over long-term memory |
|
|
32
|
+
| `hicortex_get` | `GET /memory` | Fetch one memory's full content by id (lazy-load counterpart of the recall index; marks the memory as used) |
|
|
33
|
+
| `hicortex_recent` | `GET /recent` | Recent memories by project (queryless recall) |
|
|
34
|
+
| `hicortex_ingest` | `POST /ingest` | Store a memory |
|
|
35
|
+
| `hicortex_lessons` | `GET /learnings` | Get distilled Learnings |
|
|
36
|
+
| `hicortex_index` | `GET /index` | Knowledge domain index |
|
|
37
|
+
| `hicortex_graph` | `GET /graph` | Graph queries (neighbors/hubs/path) |
|
|
38
|
+
| `hicortex_update` | `POST /update` | Update a memory (re-embeds on content change) |
|
|
39
|
+
| `hicortex_delete` | `POST /delete` | Permanently delete a memory and its links |
|
|
40
|
+
|
|
41
|
+
## Configuration
|
|
42
|
+
|
|
43
|
+
The extension self-resolves its server from `~/.hicortex/config.json` — the same file every Hicortex client uses (client mode → `serverUrl`, server mode → `localhost:8787`; `authToken` from the config, `HICORTEX_AUTH_TOKEN` env as fallback). No separate config, nothing to edit:
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
npx @gamaze/hicortex init # server / co-located machine
|
|
47
|
+
npx @gamaze/hicortex init --server <url> # thin client pointing at a remote server
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
`lessonsLimit` in the same config caps the injected Learnings block (default 10).
|
|
51
|
+
|
|
52
|
+
## Notes
|
|
53
|
+
|
|
54
|
+
- Localhost requests skip auth; remote requests need the bearer token (set at init).
|
|
55
|
+
- Requires a Hicortex server ≥ 0.14 for the pushed recall index and `hicortex_get`; against an older server recall injects nothing (fail-soft) and the remaining tools still work where the endpoints exist.
|
|
56
|
+
- Capture is not this extension's job: the nightly job on the server machine reads `~/.pi/agent/sessions/` and distills centrally. Raw sessions never leave the machine.
|