vertex-palace 0.1.3
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 +339 -0
- package/dist/palace.cjs +30113 -0
- package/package.json +57 -0
- package/plugins/vertex-palace/mcp/server.cjs +30092 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Vertex Palace Contributors
|
|
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,339 @@
|
|
|
1
|
+
# Vertex Palace
|
|
2
|
+
|
|
3
|
+
Memory-palace context routing for Codex.
|
|
4
|
+
|
|
5
|
+
Vertex Palace turns a repository into a local palace of floors, rooms, cabinets, and drawers. Before a coding task, Codex can ask for a route and receive a compact context pack instead of scanning the whole repository.
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
Name note: `记忆宫殿工具`, `记忆宫殿`, `memory palace`, `palace tool`, and the old name `Context Palace` all refer to Vertex Palace. The registered MCP tool names are `palace_status`, `palace_init`, `palace_index`, `palace_route`, `palace_pack`, and `palace_write_memory`; the CLI command is `palace`.
|
|
9
|
+
|
|
10
|
+
## English Overview
|
|
11
|
+
|
|
12
|
+
Vertex Palace is a local context-routing tool for Codex coding tasks. It organizes a repository into a memory-palace structure of floors, rooms, cabinets, and drawers, so Codex can find the most relevant files and code snippets before fixing bugs, adding features, or understanding modules.
|
|
13
|
+
|
|
14
|
+
It is designed for large repositories, multi-client projects, and long-lived codebases. You can run `palace index` to build a local index, use `palace route` to find the task path, generate a compact context pack with `palace pack`, and write task memory after the work is done. By default, everything stays inside the local `.palace/` directory: no source upload, no external API calls, and no remote vector database.
|
|
15
|
+
|
|
16
|
+
Each route refreshes `.palace/routes/latest-route.json`, `.palace/routes/latest-route.md`, and `.palace/routes/optimized-route.txt`, so the most recent task route does not get stuck on an older task. Each memory write also updates `.palace/memory/latest-task.md`, `.palace/memory/task-log.md`, and `.palace/memory/index.json` while keeping the floor-based archive under `.palace/07-memory/`.
|
|
17
|
+
|
|
18
|
+
The first floor also has an entrance pitfall board at `.palace/00-entrance/pitfall-board.md`. When a task records `--pitfall` or `--failed-attempt`, Vertex Palace updates this notice board and includes it near the top of future context packs, so Codex sees previous mistakes before reading route drawers.
|
|
19
|
+
|
|
20
|
+
## Design Philosophy
|
|
21
|
+
|
|
22
|
+
- Spatial understanding: turn a repository from a flat file list into a navigable palace that Codex can explore by feature area, dependency, and task intent.
|
|
23
|
+
- Route before reading: plan the most relevant path first, then generate a bounded context pack instead of spending tokens on unrelated files.
|
|
24
|
+
- Explainable selection: every route includes reasons for choosing a floor, room, drawer, or file, so developers can judge whether Codex is looking in the right place.
|
|
25
|
+
- Local-first privacy: indexes, route packs, and task memory are generated locally by default.
|
|
26
|
+
- Project memory over time: successful routes, failed routes, client labels, and decisions can be reused by future tasks.
|
|
27
|
+
|
|
28
|
+
## Usage Guide
|
|
29
|
+
|
|
30
|
+
### Lazy Mode: Ask Your AI Agent
|
|
31
|
+
|
|
32
|
+
If you just want the agent to handle it, give your AI coding agent this prompt:
|
|
33
|
+
|
|
34
|
+
```text
|
|
35
|
+
Open and read https://github.com/lohchanhin/vertex-palace, install Vertex Palace, then use it in this repository.
|
|
36
|
+
|
|
37
|
+
Before working, check Vertex Palace status, initialize and index the repository if needed, route my task, generate a minimal context pack, inspect the routed files first, and write task memory after finishing.
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
The agent should read the repository instructions, install the plugin or use the CLI, then follow this workflow:
|
|
41
|
+
|
|
42
|
+
```text
|
|
43
|
+
status -> init/index if needed -> route -> pack -> inspect routed files -> implement -> test -> memory write
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Before following a route, the agent should read `.palace/00-entrance/pitfall-board.md` when it exists.
|
|
47
|
+
|
|
48
|
+
### Manual Mode: Step By Step
|
|
49
|
+
|
|
50
|
+
1. Install the plugin:
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
codex plugin marketplace add lohchanhin/vertex-palace --ref v0.1.3
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Use `v0.1.3` or newer. Avoid `v0.1.0` and `v0.1.1`; those early tags had broken MCP install metadata.
|
|
57
|
+
|
|
58
|
+
2. Or install the CLI directly from npm:
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
npm install -g vertex-palace
|
|
62
|
+
palace status
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
For one-off use without a global install:
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
npx vertex-palace status
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
3. Open Codex and install Vertex Palace from `/plugins`.
|
|
72
|
+
|
|
73
|
+
4. Initialize and index a repository:
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
palace init
|
|
77
|
+
palace index
|
|
78
|
+
palace status
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
5. Before each task, create a route and context pack:
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
palace route "fix login refresh token bug" --limit 8 --compact
|
|
85
|
+
palace pack "fix login refresh token bug" --budget 6000 --route-limit 8 --max-drawers 4 --compact --out .palace/last-pack.md
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
6. Read the latest task route:
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
cat .palace/routes/optimized-route.txt
|
|
92
|
+
cat .palace/routes/latest-route.md
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
7. After the task, write memory:
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
palace memory write \
|
|
99
|
+
--task "fix login refresh token bug" \
|
|
100
|
+
--outcome success \
|
|
101
|
+
--changed-file src/auth/token.service.ts \
|
|
102
|
+
--test "pnpm test|passed|auth tests passed" \
|
|
103
|
+
--decision "Kept refresh token validation in the auth service." \
|
|
104
|
+
--pitfall "Do not trust stale optimized-route.txt before checking latest-route.md." \
|
|
105
|
+
--tag auth \
|
|
106
|
+
--tag token \
|
|
107
|
+
--notes "Route was accurate; auth controller and token service were the key files."
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
8. Check the readable memory ledger:
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
cat .palace/memory/latest-task.md
|
|
114
|
+
cat .palace/memory/task-log.md
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
### Troubleshooting: Agent Does Not Recognize The Tool
|
|
118
|
+
|
|
119
|
+
If a Codex thread says it does not know the "memory palace tool" or `记忆宫殿工具`, it usually means the Vertex Palace plugin or MCP server is not loaded in that thread. The Chinese name is an alias; the actual tool names are `palace_status`, `palace_route`, `palace_pack`, and the other `palace_*` MCP tools.
|
|
120
|
+
|
|
121
|
+
Fix it by installing Vertex Palace from `/plugins`, trusting the plugin when prompted, and starting a new Codex thread or restarting Codex so the skill, hooks, and MCP tools reload. If only the CLI is available, ask the agent to use `palace status`, `palace index`, `palace route`, and `palace pack`.
|
|
122
|
+
|
|
123
|
+
## 简体中文说明
|
|
124
|
+
|
|
125
|
+
Vertex Palace 是一个面向 Codex 编程任务的本地上下文路由工具。它会把代码仓库整理成“楼层、房间、柜子、抽屉”的空间结构,让 Codex 在开始修 bug、加功能或理解模块前,先找到最相关的文件与代码片段,而不是每次都从整个仓库重新扫描。
|
|
126
|
+
|
|
127
|
+
它适合大型项目、多客户项目和长期维护型项目:你可以先用 `palace index` 建立本地索引,再用 `palace route` 找到任务路径,用 `palace pack` 生成精简上下文包,并在任务结束后写入成功路径、失败路径和决策记忆。所有数据默认保存在本机 `.palace/` 目录中,不上传源码,也不依赖远程向量数据库。
|
|
128
|
+
|
|
129
|
+
每次路由都会刷新 `.palace/routes/latest-route.json`、`.palace/routes/latest-route.md` 和 `.palace/routes/optimized-route.txt`,避免“最近任务路线”停留在旧任务。每次写入记忆也会更新 `.palace/memory/latest-task.md`、`.palace/memory/task-log.md` 和 `.palace/memory/index.json`,同时保留 `.palace/07-memory/` 的楼层归档。
|
|
130
|
+
|
|
131
|
+
第一层入口还会有一个踩坑告示牌:`.palace/00-entrance/pitfall-board.md`。当任务写入 `--pitfall` 或 `--failed-attempt` 时,Vertex Palace 会更新这个告示牌,并在后续 context pack 的前段显示它,让 Codex 在读路线抽屉前先看到之前踩过的坑。
|
|
132
|
+
|
|
133
|
+
名称说明:`记忆宫殿工具`、`记忆宫殿`、`memory palace`、`palace tool` 和旧名字 `Context Palace` 都是 Vertex Palace。真正注册到 Codex 的 MCP 工具名是 `palace_status`、`palace_init`、`palace_index`、`palace_route`、`palace_pack` 和 `palace_write_memory`;命令行工具名是 `palace`。
|
|
134
|
+
|
|
135
|
+
## 设计理念
|
|
136
|
+
|
|
137
|
+
- 空间化理解:把仓库从“文件列表”变成可导航的宫殿结构,让 Codex 可以按功能区域、依赖关系和任务目标定位上下文。
|
|
138
|
+
- 先路由,再阅读:先规划最可能相关的路径,再生成有限预算内的上下文包,减少无关文件占用 token。
|
|
139
|
+
- 可解释的选择:路由结果会说明为什么选择某个房间、抽屉或文件,方便开发者判断 Codex 是否走在正确方向上。
|
|
140
|
+
- 本地优先与隐私优先:索引、记忆和上下文包默认都在本地生成,避免把项目源码交给外部服务处理。
|
|
141
|
+
- 持续学习项目习惯:任务完成后记录成功路线、失败路线、客户标签和决策原因,让后续任务可以复用项目经验。
|
|
142
|
+
|
|
143
|
+
## 使用说明
|
|
144
|
+
|
|
145
|
+
### 懒人用法:直接叫 AI Agent 去读、下载、使用
|
|
146
|
+
|
|
147
|
+
把这段话丢给你的 AI coding agent:
|
|
148
|
+
|
|
149
|
+
```text
|
|
150
|
+
请打开并阅读 https://github.com/lohchanhin/vertex-palace,安装 Vertex Palace,然后在当前项目使用它。
|
|
151
|
+
|
|
152
|
+
开始任务前,请先检查 Vertex Palace 状态;如果还没初始化或索引过,就先 init/index;然后根据我的任务 route,生成最小 context pack,优先阅读路线推荐文件,完成后把改动文件、测试结果、决策和踩坑写入 memory。
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
它应该照这个流程做:
|
|
156
|
+
|
|
157
|
+
```text
|
|
158
|
+
status -> 需要时 init/index -> route -> pack -> 先读路线文件 -> 执行任务 -> 测试 -> 写入 memory
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
执行 route 前,agent 应该先读 `.palace/00-entrance/pitfall-board.md`,避免重复踩坑。
|
|
162
|
+
|
|
163
|
+
### 勤劳用法:自己一步一步跑
|
|
164
|
+
|
|
165
|
+
1. 安装插件:
|
|
166
|
+
|
|
167
|
+
```bash
|
|
168
|
+
codex plugin marketplace add lohchanhin/vertex-palace --ref v0.1.3
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
请使用 `v0.1.3` 或更新版本。不要再使用 `v0.1.0` 和 `v0.1.1`,这两个早期标签的 MCP 安装元数据有问题。
|
|
172
|
+
|
|
173
|
+
2. 打开 Codex,输入 `/plugins`,安装 Vertex Palace。
|
|
174
|
+
|
|
175
|
+
3. 在项目里初始化并建立索引:
|
|
176
|
+
|
|
177
|
+
```bash
|
|
178
|
+
palace init
|
|
179
|
+
palace index
|
|
180
|
+
palace status
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
4. 每次任务前先规划路线和上下文包:
|
|
184
|
+
|
|
185
|
+
```bash
|
|
186
|
+
palace route "fix login refresh token bug" --limit 8 --compact
|
|
187
|
+
palace pack "fix login refresh token bug" --budget 6000 --route-limit 8 --max-drawers 4 --compact --out .palace/last-pack.md
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
5. 查看最新路线:
|
|
191
|
+
|
|
192
|
+
```bash
|
|
193
|
+
cat .palace/routes/optimized-route.txt
|
|
194
|
+
cat .palace/routes/latest-route.md
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
6. 任务完成后写入记忆:
|
|
198
|
+
|
|
199
|
+
```bash
|
|
200
|
+
palace memory write \
|
|
201
|
+
--task "fix login refresh token bug" \
|
|
202
|
+
--outcome success \
|
|
203
|
+
--changed-file src/auth/token.service.ts \
|
|
204
|
+
--test "pnpm test|passed|auth tests passed" \
|
|
205
|
+
--decision "refresh token validation 保留在 auth service。" \
|
|
206
|
+
--pitfall "不要在确认 latest-route.md 前盲目信任旧的 optimized-route.txt。" \
|
|
207
|
+
--tag auth \
|
|
208
|
+
--tag token \
|
|
209
|
+
--notes "路线准确,auth controller 和 token service 是关键文件。"
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
7. 查看长期记忆:
|
|
213
|
+
|
|
214
|
+
```bash
|
|
215
|
+
cat .palace/memory/latest-task.md
|
|
216
|
+
cat .palace/memory/task-log.md
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
### 排障:AI Agent 说不认识“记忆宫殿工具”
|
|
220
|
+
|
|
221
|
+
如果某个 Codex 线程说不认识“记忆宫殿工具”,通常不是项目坏了,而是那个线程还没有加载 Vertex Palace 插件或 MCP server。中文叫法只是别名,实际工具名是 `palace_status`、`palace_route`、`palace_pack` 等 `palace_*` 工具。
|
|
222
|
+
|
|
223
|
+
处理方式:先在 Codex 的 `/plugins` 安装并启用 Vertex Palace,按提示信任插件,然后新开一个 Codex 线程或重启 Codex,让 skill、hooks 和 MCP 工具重新加载。如果当前环境只有命令行可用,就让 agent 改用 `palace status`、`palace index`、`palace route` 和 `palace pack`。
|
|
224
|
+
|
|
225
|
+
## Install
|
|
226
|
+
|
|
227
|
+
Install the CLI from npm:
|
|
228
|
+
|
|
229
|
+
```bash
|
|
230
|
+
npm install -g vertex-palace
|
|
231
|
+
palace status
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
Run it without a global install:
|
|
235
|
+
|
|
236
|
+
```bash
|
|
237
|
+
npx vertex-palace status
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
Install the Codex plugin:
|
|
241
|
+
|
|
242
|
+
```bash
|
|
243
|
+
codex plugin marketplace add lohchanhin/vertex-palace --ref v0.1.3
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
Use `v0.1.3` or newer; `v0.1.0` and `v0.1.1` are obsolete because their MCP install metadata was broken.
|
|
247
|
+
|
|
248
|
+
The plugin launches its MCP server through npm:
|
|
249
|
+
|
|
250
|
+
```bash
|
|
251
|
+
npx -y -p vertex-palace@0.1.3 vertex-palace-mcp --stdio
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
Open Codex:
|
|
255
|
+
|
|
256
|
+
```text
|
|
257
|
+
/plugins
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
Install Vertex Palace.
|
|
261
|
+
|
|
262
|
+
## First Use
|
|
263
|
+
|
|
264
|
+
```text
|
|
265
|
+
Use Vertex Palace to index this repository.
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
This creates:
|
|
269
|
+
|
|
270
|
+
```text
|
|
271
|
+
.palace/
|
|
272
|
+
palace.yml
|
|
273
|
+
indexes/
|
|
274
|
+
rooms/
|
|
275
|
+
routes/
|
|
276
|
+
07-memory/
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
## Normal Use
|
|
280
|
+
|
|
281
|
+
```text
|
|
282
|
+
Use Vertex Palace before fixing this bug: fix login refresh token bug
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
Codex should route first, pack only the useful drawers, inspect those files, and write memory after the task.
|
|
286
|
+
|
|
287
|
+
## CLI
|
|
288
|
+
|
|
289
|
+
```bash
|
|
290
|
+
palace init
|
|
291
|
+
palace status
|
|
292
|
+
palace index
|
|
293
|
+
palace route "fix login refresh token bug"
|
|
294
|
+
palace pack "fix login refresh token bug" --budget 12000
|
|
295
|
+
palace doctor
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
### Token-Saving Workflow
|
|
299
|
+
|
|
300
|
+
For large repositories, write packs to disk and keep the first pass intentionally small:
|
|
301
|
+
|
|
302
|
+
```bash
|
|
303
|
+
palace route "fix checkout shipping bug" --limit 8 --compact --out .palace/last-route.txt
|
|
304
|
+
palace pack "fix checkout shipping bug" --budget 6000 --route-limit 8 --max-drawers 4 --compact --out .palace/last-pack.md
|
|
305
|
+
```
|
|
306
|
+
|
|
307
|
+
For multi-client repositories, isolate task memory with a client label:
|
|
308
|
+
|
|
309
|
+
```bash
|
|
310
|
+
palace memory write \
|
|
311
|
+
--client imishang \
|
|
312
|
+
--task "fix checkout shipping bug" \
|
|
313
|
+
--outcome success \
|
|
314
|
+
--changed-file frontend/app/checkout/page.tsx \
|
|
315
|
+
--test "pnpm test|passed|checkout tests passed" \
|
|
316
|
+
--tag checkout \
|
|
317
|
+
--tag tenant-config \
|
|
318
|
+
--notes "Kept shipping rules configurable."
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
## Privacy
|
|
322
|
+
|
|
323
|
+
Vertex Palace runs locally by default. It does not upload source code, call external APIs, use embeddings, or create a remote index.
|
|
324
|
+
|
|
325
|
+
## Current Capabilities / 目前能力
|
|
326
|
+
|
|
327
|
+
- Local memory-palace data model
|
|
328
|
+
- Repository scanner with ignore rules
|
|
329
|
+
- TypeScript, JavaScript, Markdown, JSON, and fallback parsers
|
|
330
|
+
- Indexes for nodes, edges, rooms, symbols, directory tree, hashes, and routes
|
|
331
|
+
- Route planner with task classification, confidence, reasons, and excluded areas
|
|
332
|
+
- Latest route files: `latest-route.json`, `latest-route.md`, and `optimized-route.txt`
|
|
333
|
+
- Markdown and JSON context packer
|
|
334
|
+
- Task memory ledger: `latest-task.md`, `task-log.md`, and `index.json`
|
|
335
|
+
- Entrance pitfall board: `.palace/00-entrance/pitfall-board.md`
|
|
336
|
+
- CLI
|
|
337
|
+
- MCP stdio server
|
|
338
|
+
- Codex plugin folder, skill, hooks, and marketplace metadata
|
|
339
|
+
- Fixture repos and tests
|