waymark-hub 1.0.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/LICENSE +21 -0
- package/README.md +176 -0
- package/dashboard/README.md +71 -0
- package/dashboard/index.html +520 -0
- package/dashboard/server.mjs +343 -0
- package/dashboard/vendor/tailwind.js +83 -0
- package/dist/cli/benchmark.d.ts +3 -0
- package/dist/cli/benchmark.d.ts.map +1 -0
- package/dist/cli/benchmark.js +222 -0
- package/dist/cli/benchmark.js.map +1 -0
- package/dist/cli/waymark.d.ts +3 -0
- package/dist/cli/waymark.d.ts.map +1 -0
- package/dist/cli/waymark.js +216 -0
- package/dist/cli/waymark.js.map +1 -0
- package/dist/context/builder.d.ts +67 -0
- package/dist/context/builder.d.ts.map +1 -0
- package/dist/context/builder.js +270 -0
- package/dist/context/builder.js.map +1 -0
- package/dist/db/client.d.ts +5 -0
- package/dist/db/client.d.ts.map +1 -0
- package/dist/db/client.js +67 -0
- package/dist/db/client.js.map +1 -0
- package/dist/db/migrations/001_initial.sql +85 -0
- package/dist/db/migrations/002_usage_experiments.sql +52 -0
- package/dist/db/migrations/003_agent_identity.sql +37 -0
- package/dist/db/migrations/004_memory_lifecycle.sql +25 -0
- package/dist/db/migrations/005_task_coordination.sql +17 -0
- package/dist/db/schema.d.ts +132 -0
- package/dist/db/schema.d.ts.map +1 -0
- package/dist/db/schema.js +3 -0
- package/dist/db/schema.js.map +1 -0
- package/dist/server.d.ts +12 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +164 -0
- package/dist/server.js.map +1 -0
- package/dist/telemetry/tokens.d.ts +9 -0
- package/dist/telemetry/tokens.d.ts.map +1 -0
- package/dist/telemetry/tokens.js +23 -0
- package/dist/telemetry/tokens.js.map +1 -0
- package/dist/tools/agents.d.ts +3 -0
- package/dist/tools/agents.d.ts.map +1 -0
- package/dist/tools/agents.js +126 -0
- package/dist/tools/agents.js.map +1 -0
- package/dist/tools/context.d.ts +3 -0
- package/dist/tools/context.d.ts.map +1 -0
- package/dist/tools/context.js +53 -0
- package/dist/tools/context.js.map +1 -0
- package/dist/tools/memory.d.ts +3 -0
- package/dist/tools/memory.d.ts.map +1 -0
- package/dist/tools/memory.js +273 -0
- package/dist/tools/memory.js.map +1 -0
- package/dist/tools/projects.d.ts +3 -0
- package/dist/tools/projects.d.ts.map +1 -0
- package/dist/tools/projects.js +92 -0
- package/dist/tools/projects.js.map +1 -0
- package/dist/tools/sessions.d.ts +3 -0
- package/dist/tools/sessions.d.ts.map +1 -0
- package/dist/tools/sessions.js +113 -0
- package/dist/tools/sessions.js.map +1 -0
- package/dist/tools/tasks.d.ts +3 -0
- package/dist/tools/tasks.d.ts.map +1 -0
- package/dist/tools/tasks.js +304 -0
- package/dist/tools/tasks.js.map +1 -0
- package/dist/tools/telemetry.d.ts +3 -0
- package/dist/tools/telemetry.d.ts.map +1 -0
- package/dist/tools/telemetry.js +291 -0
- package/dist/tools/telemetry.js.map +1 -0
- package/docs/AGENT_IDENTITY.md +67 -0
- package/docs/BENCHMARKING.md +161 -0
- package/docs/CONTEXT.md +95 -0
- package/docs/MEMORY_LIFECYCLE.md +65 -0
- package/docs/TASK_COORDINATION.md +27 -0
- package/package.json +70 -0
- package/scripts/hooks/session-start-resume.cjs +70 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Serj
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
# Waymark
|
|
2
|
+
|
|
3
|
+
[](https://github.com/SerjMihashin/waymark/actions/workflows/ci.yml)
|
|
4
|
+
[](./LICENSE)
|
|
5
|
+
|
|
6
|
+
**Shared memory and handoff hub for AI agents.** A waymark is a trail sign left
|
|
7
|
+
for whoever walks the path next — Waymark does the same for agent sessions:
|
|
8
|
+
Claude Code finishes work, and the next session of Codex, Claude Desktop, or any
|
|
9
|
+
other MCP client starts *already knowing* what was done, what was decided, and
|
|
10
|
+
what to do next.
|
|
11
|
+
|
|
12
|
+
No retelling. No re-reading the repo. One token-budgeted call.
|
|
13
|
+
|
|
14
|
+
## Why
|
|
15
|
+
|
|
16
|
+
Every new agent session starts cold: it re-reads files, re-asks questions, and
|
|
17
|
+
burns tokens rediscovering context that another agent had five minutes ago.
|
|
18
|
+
Waymark replaces that with a local MCP server over a single SQLite database
|
|
19
|
+
shared by all your agents:
|
|
20
|
+
|
|
21
|
+
- **`workspace_resume`** — one call returns a compact packet (project metadata,
|
|
22
|
+
open tasks, ranked memory, recent sessions, active handoff) within a token
|
|
23
|
+
budget you set (default 1,200 tokens).
|
|
24
|
+
- **Automatic handoffs** — `session_log(outcome: "partial", next_steps: [...])`
|
|
25
|
+
writes a handoff memory that tops the next agent's resume. Logging
|
|
26
|
+
`completed` retires it. No discipline required.
|
|
27
|
+
- **Task queue with atomic claims** — `task_claim` guarantees only one agent
|
|
28
|
+
takes a task, with capability and dependency checks.
|
|
29
|
+
- **Memory lifecycle** — supersede instead of accumulate; feedback ratings
|
|
30
|
+
demote stale records in ranking.
|
|
31
|
+
- **Provider-neutral** — agents register with provider/model/client identity;
|
|
32
|
+
nothing in the core is tied to one vendor.
|
|
33
|
+
|
|
34
|
+
## Measured savings
|
|
35
|
+
|
|
36
|
+
Continuation scenario (fresh session must orient in a project and name the next
|
|
37
|
+
step), estimated cohort, reproducible via `node scripts/benchmark-orientation.cjs`:
|
|
38
|
+
|
|
39
|
+
| | median tokens |
|
|
40
|
+
|---|---|
|
|
41
|
+
| Cold orientation (reading README, docs, sources, git log) | **13,540** |
|
|
42
|
+
| Waymark resume (packet + core tool schemas + follow-up reads) | **3,392** |
|
|
43
|
+
| **Net saving** | **74.9%** |
|
|
44
|
+
|
|
45
|
+
The orientation context itself shrinks from ~13.1k tokens of raw files to a
|
|
46
|
+
1.1k-token ranked packet (**−91.5%**) — and unlike cold reading, the packet
|
|
47
|
+
contains what files can't: what the previous agent actually did and decided.
|
|
48
|
+
The exact-token A/B protocol with live clients is in
|
|
49
|
+
[docs/BENCHMARK_RUN.md](./docs/BENCHMARK_RUN.md).
|
|
50
|
+
|
|
51
|
+
## Quick start
|
|
52
|
+
|
|
53
|
+
Requires Node.js 22+.
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
npm install -g waymark-hub
|
|
57
|
+
waymark-hub init # registers the hub in Claude Code / Codex, offers the hook
|
|
58
|
+
waymark-hub doctor # verifies the whole installation
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
`init` asks before touching anything; `init --yes` enables everything
|
|
62
|
+
applicable. The database lives in `~/.waymark/hub.db` (survives package
|
|
63
|
+
upgrades); override with `WAYMARK_HOME` or `DB_PATH`.
|
|
64
|
+
|
|
65
|
+
From source instead:
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
git clone https://github.com/SerjMihashin/waymark && cd waymark
|
|
69
|
+
npm install && npm test # build + 20 integration tests
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### Connect Claude Code (stdio)
|
|
73
|
+
|
|
74
|
+
`waymark-hub init --claude`, or manually:
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
claude mcp add --scope user waymark node "<install>/dist/server.js"
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
Optional but recommended — `waymark-hub init --hook` installs a `SessionStart`
|
|
81
|
+
hook that injects the resume packet into every new session (zero tool calls
|
|
82
|
+
spent on orientation).
|
|
83
|
+
|
|
84
|
+
### Connect Codex
|
|
85
|
+
|
|
86
|
+
`waymark-hub init --codex`, or manually:
|
|
87
|
+
|
|
88
|
+
```toml
|
|
89
|
+
# ~/.codex/config.toml
|
|
90
|
+
[mcp_servers.waymark]
|
|
91
|
+
command = "node"
|
|
92
|
+
args = ["<install>/dist/server.js"]
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### Connect Claude Desktop / web (HTTP)
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
waymark-hub serve --http # listens on 127.0.0.1:3747
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
Add a custom connector: `http://localhost:3747/mcp`. Also available via
|
|
102
|
+
`docker compose up -d` / `podman compose up -d`.
|
|
103
|
+
|
|
104
|
+
## The protocol
|
|
105
|
+
|
|
106
|
+
**Session start — one call, not three:**
|
|
107
|
+
|
|
108
|
+
```
|
|
109
|
+
workspace_resume(project_id, task?, agent_id?, max_tokens=1200)
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
**Session end:**
|
|
113
|
+
|
|
114
|
+
```
|
|
115
|
+
session_log(started_at, summary, outcome, next_steps?) # partial/blocked → auto-handoff
|
|
116
|
+
memory_write(...) # only durable decisions/facts
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
**Cross-agent handoff** happens automatically: agent A logs a `partial` session
|
|
120
|
+
with `next_steps`; agent B's `workspace_resume` surfaces that handoff first,
|
|
121
|
+
with the session trail and files touched. When someone logs `completed`, the
|
|
122
|
+
handoff retires itself.
|
|
123
|
+
|
|
124
|
+
## Tool profiles
|
|
125
|
+
|
|
126
|
+
Greedy MCP clients inject every tool schema into context each turn. Waymark
|
|
127
|
+
defaults to a **core** profile of 10 tools (~1.8k tokens instead of ~4.7k for
|
|
128
|
+
all 28). Set `HUB_TOOLS=full` where you need the admin surface (projects,
|
|
129
|
+
agents, experiments, telemetry).
|
|
130
|
+
|
|
131
|
+
## Tools (28)
|
|
132
|
+
|
|
133
|
+
| Group | Tools |
|
|
134
|
+
|---|---|
|
|
135
|
+
| Context | `workspace_resume`, `context_get` |
|
|
136
|
+
| Memory | `memory_write/read/list/search/set_status/feedback` |
|
|
137
|
+
| Tasks | `task_create/list/update/claim/release/add_dependency` |
|
|
138
|
+
| Projects | `project_list/get/upsert/set_status` |
|
|
139
|
+
| Agents | `agent_register/get/list/set_status` |
|
|
140
|
+
| Sessions & telemetry | `session_log`, `usage_report`, `experiment_create/list/update/summary` |
|
|
141
|
+
|
|
142
|
+
Deep dives: [docs/CONTEXT.md](./docs/CONTEXT.md),
|
|
143
|
+
[docs/MEMORY_LIFECYCLE.md](./docs/MEMORY_LIFECYCLE.md),
|
|
144
|
+
[docs/TASK_COORDINATION.md](./docs/TASK_COORDINATION.md),
|
|
145
|
+
[docs/BENCHMARKING.md](./docs/BENCHMARKING.md).
|
|
146
|
+
|
|
147
|
+
## Dashboard
|
|
148
|
+
|
|
149
|
+
`npm run dashboard` → read-only web panel on `http://localhost:4747`: projects,
|
|
150
|
+
tasks, memory (FTS search), sessions, agents, benchmark results. Opens the DB
|
|
151
|
+
in read-only mode — it physically cannot mutate hub state.
|
|
152
|
+
|
|
153
|
+
## Architecture
|
|
154
|
+
|
|
155
|
+
```
|
|
156
|
+
src/server.ts entry point: stdio / HTTP (--http), tool profiles
|
|
157
|
+
src/db/client.ts SQLite singleton (WAL) + idempotent migrations 001..005
|
|
158
|
+
src/tools/ projects · memory · tasks · sessions · agents · context · telemetry
|
|
159
|
+
src/context/builder.ts deterministic ranking + token budget (no LLM calls)
|
|
160
|
+
src/cli/benchmark.ts A/B experiment CLI
|
|
161
|
+
dashboard/ read-only Express panel
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
Storage: SQLite + FTS5. The core never calls an LLM or any external service.
|
|
165
|
+
|
|
166
|
+
## Principles
|
|
167
|
+
|
|
168
|
+
- **Context on demand** — summaries + ids by default; bodies only when asked.
|
|
169
|
+
- **Budget first** — every aggregated response fits a token budget.
|
|
170
|
+
- **Evidence over retelling** — link files/commits/tasks instead of copying text.
|
|
171
|
+
- **Replace, don't accumulate** — supersede outdated memory, no duplicates.
|
|
172
|
+
- **Provider-agnostic** — any MCP client is a first-class citizen.
|
|
173
|
+
|
|
174
|
+
## License
|
|
175
|
+
|
|
176
|
+
MIT
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# Waymark — Dashboard
|
|
2
|
+
|
|
3
|
+
Веб-панель хаба: тропа передач между агентами, доска задач, память с поиском,
|
|
4
|
+
журнал сессий, агенты, бенчмарки. Живое обновление — панель следит за
|
|
5
|
+
изменениями БД и перерисовывается сама.
|
|
6
|
+
|
|
7
|
+
## Запуск
|
|
8
|
+
|
|
9
|
+
```powershell
|
|
10
|
+
npm run dashboard
|
|
11
|
+
# → http://127.0.0.1:4747
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
Слушает только loopback (`127.0.0.1`). Настройки через переменные окружения:
|
|
15
|
+
|
|
16
|
+
- `DASH_PORT` — порт (по умолчанию `4747`).
|
|
17
|
+
- `DB_PATH` — путь к базе (по умолчанию `../data/hub.db` относительно этой папки,
|
|
18
|
+
то есть та же база, что у хаба).
|
|
19
|
+
- `WAYMARK_ADMIN=1` — включить admin-режим (см. ниже).
|
|
20
|
+
|
|
21
|
+
## Вкладки
|
|
22
|
+
|
|
23
|
+
- **Обзор** — счётчики, задачи по статусам, активные передачи.
|
|
24
|
+
- **Тропа** — фирменный вид: маршрут сессий проекта в хронологии. Оранжевый
|
|
25
|
+
ромб — «blaze», метка передачи: агент оставил эстафету (`session_log` с
|
|
26
|
+
outcome partial/blocked). Активная эстафета закреплена сверху — это то, что
|
|
27
|
+
следующий агент увидит первым в `workspace_resume`.
|
|
28
|
+
- **Задачи** — доска по статусам (очередь → в работе → готово → отменено).
|
|
29
|
+
- **Память** — фильтры по типу и статусу, поиск, важность/уверенность,
|
|
30
|
+
раскрытие тел по клику.
|
|
31
|
+
- **Сессии / Агенты / Бенчмарки** — журнал работы, команда, A/B-эксперименты.
|
|
32
|
+
|
|
33
|
+
## Режимы: read-only и admin
|
|
34
|
+
|
|
35
|
+
**По умолчанию — только чтение.** База открывается в режиме `readonly`,
|
|
36
|
+
панель физически не может изменить состояние, на которое полагаются агенты.
|
|
37
|
+
|
|
38
|
+
**`WAYMARK_ADMIN=1`** добавляет точечные действия: перевод задач по статусам и
|
|
39
|
+
архивирование записей памяти. Записи идут **через MCP-инструменты самого хаба**
|
|
40
|
+
(in-process клиент → `task_update`, `memory_set_status`), а не сырым SQL — вся
|
|
41
|
+
логика хаба (completed_at, FTS, валидация статусов) сохраняется. Без переменной
|
|
42
|
+
окружения admin-эндпоинты отвечают 403.
|
|
43
|
+
|
|
44
|
+
```powershell
|
|
45
|
+
$env:WAYMARK_ADMIN='1'; npm run dashboard
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Перевод на русский (опционально)
|
|
49
|
+
|
|
50
|
+
Кнопка **RU** в шапке включает машинный перевод содержимого (описания, сводки
|
|
51
|
+
сессий, тела памяти) на русский. Подписи интерфейса и так русские — переводится
|
|
52
|
+
только то, что агенты записали по-английски.
|
|
53
|
+
|
|
54
|
+
⚠️ **Приватность.** Перевод выполняется через DeepSeek API, то есть выбранный
|
|
55
|
+
текст хаба **отправляется на внешний сервер** `api.deepseek.com`. Панель
|
|
56
|
+
предупредит и спросит согласие при первом включении. Ключ берётся из
|
|
57
|
+
`DEEPSEEK_API_KEY` или `~/.deepseek-code/settings.json` и **остаётся на
|
|
58
|
+
сервере** (в браузер не передаётся). Каждый уникальный текст переводится один
|
|
59
|
+
раз и кешируется в `dashboard/.cache/` (в git не попадает). Тела памяти
|
|
60
|
+
переводятся лениво — только при раскрытии.
|
|
61
|
+
|
|
62
|
+
## Как устроено
|
|
63
|
+
|
|
64
|
+
- `server.mjs` — Express-сервер: JSON API (`/api/*`) поверх `hub.db` через
|
|
65
|
+
read-only `better-sqlite3`; `/api/stats` отдаёт `data_version` для живого
|
|
66
|
+
обновления; admin-режим поднимает in-process MCP-клиент к хабу. Никаких новых
|
|
67
|
+
зависимостей — переиспользует `express` и `better-sqlite3` самого хаба.
|
|
68
|
+
- `index.html` — одностраничный UI (vanilla JS + Tailwind), палитра «карта
|
|
69
|
+
ночью»: чернильный фон, сигнальный blaze-оранжевый для передач.
|
|
70
|
+
- `vendor/tailwind.js` — Tailwind, заверстан локально (без внешнего CDN):
|
|
71
|
+
работает офлайн, нет риска компрометации CDN.
|