vertex-palace 0.1.4 → 0.2.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/BUILD_WEEK.md ADDED
@@ -0,0 +1,79 @@
1
+ # OpenAI Build Week
2
+
3
+ Vertex Palace is entering the Developer Tools track as a local context-routing and project-memory tool for Codex.
4
+
5
+ ## Eligibility Timeline
6
+
7
+ Vertex Palace existed before the OpenAI Build Week submission period. The pre-existing baseline is:
8
+
9
+ - Tag: `v0.1.4`
10
+ - Commit: `462bf56ad55e1a9394d72f249c2b905ee01e8f45`
11
+ - Baseline capabilities: repository indexing, task routes, context packs, task memory, CLI, MCP, and Codex plugin packaging
12
+
13
+ Only the work added after the submission period began is presented as Build Week work.
14
+
15
+ ## Submission-Period Work
16
+
17
+ ### Routing and indexing reliability
18
+
19
+ Commit `ce26cd66f99019a45e97787ffe1bdfe659541454` added stricter nested-repository ignores, stale room cleanup, more diverse route selection, fixture filtering, task-intent improvements, pitfall relevance changes, and regression tests.
20
+
21
+ ### Measurable route evaluation
22
+
23
+ Version 0.1.5 adds `palace evaluate` and the `palace_evaluate` MCP tool. The evaluator:
24
+
25
+ - compares estimated tokens for all indexed repository text with the actual context pack
26
+ - calculates changed-file coverage and route focus from files supplied after the task
27
+ - compares predicted route confidence with observed coverage
28
+ - labels confidence as well-calibrated, overconfident, underconfident, or unverified
29
+ - saves reproducible Markdown and JSON reports in `.palace/evaluations/`
30
+
31
+ This feature addresses a concrete limitation found during large-project use: a plausible-looking route and a high confidence value do not prove that the route included the files that ultimately mattered.
32
+
33
+ ## Codex And GPT-5.6 Collaboration
34
+
35
+ The submission-period work was developed with Codex using GPT-5.6. Codex was used to:
36
+
37
+ - run Vertex Palace against its own repository before implementation
38
+ - inspect the minimal routed context and expand only when the route omitted required CLI, MCP, and shared contracts
39
+ - translate real large-project feedback into measurable behavior and regression tests
40
+ - identify that the public npm/plugin pin still referenced the pre-submission baseline
41
+ - design the evaluation contract, implement the cross-package feature, and verify CLI and MCP behavior
42
+
43
+ Human product and engineering decisions included:
44
+
45
+ - keeping evaluation deterministic and local instead of adding a remote model or vector database
46
+ - treating changed-file coverage as observed evidence, not as a replacement for tests or runtime verification
47
+ - reporting route focus separately because useful dependency files may be routed without being edited
48
+ - refusing to publish a new plugin pin until the corresponding npm package exists and passes clean-install tests
49
+
50
+ The Devpost submission will include the `/feedback` Session ID from the primary Build Week development task.
51
+
52
+ ## Judge Quick Test
53
+
54
+ Install the public competition release, then run it in the repository you want to evaluate:
55
+
56
+ ```bash
57
+ npm install -g vertex-palace@0.2.0
58
+ palace --version
59
+ palace context "improve route confidence calibration" --auto --format json
60
+ palace evaluate "improve route confidence calibration" --changed-file packages/core/src/evaluation/evaluate-route.ts
61
+ ```
62
+
63
+ The evaluation command prints a report and saves:
64
+
65
+ ```text
66
+ .palace/evaluations/latest-evaluation.md
67
+ .palace/evaluations/latest-evaluation.json
68
+ ```
69
+
70
+ The Codex plugin is pinned to the same npm release, so judges do not need to rebuild the project.
71
+
72
+ ## Verification Gates
73
+
74
+ - All workspace tests pass.
75
+ - TypeScript no-emit checks pass.
76
+ - The root CLI bundle builds.
77
+ - The bundled MCP server answers framed JSON-RPC `initialize` and `tools/list` requests.
78
+ - The npm tarball is installed and exercised from a clean temporary directory before publishing.
79
+ - The plugin MCP pin matches the published competition release.
package/CHANGELOG.md ADDED
@@ -0,0 +1,66 @@
1
+ # Changelog
2
+
3
+ ## Unreleased
4
+
5
+ ## 0.2.0 - 2026-07-19
6
+
7
+ ### Added
8
+
9
+ - Adaptive `palace context --auto` mode selection across `bypass`, `route-lite`, `full-palace`, and `guarded-memory-palace`.
10
+ - Primary, Support, and Deferred route tiers with per-step confidence and evidence.
11
+ - Measured payload metrics for actual context bytes, estimated tokens, route tiers, memory items, and guardrails.
12
+ - One canonical context serializer shared by Core, CLI, and MCP, so payload metrics describe the final delivered Markdown or formatted JSON body without a duplicate MCP wrapper.
13
+ - Guarded memory retrieval with relevance, scope, age, confidence, risk, contradiction checks, and a 600-token ceiling.
14
+ - CLI `--mode` override and equivalent `auto` / `mode` inputs on the `palace_context` MCP tool for repeatable evaluation.
15
+
16
+ ### Changed
17
+
18
+ - Adaptive route-lite packs load file summaries instead of accidentally expanding file-level snippets into full files.
19
+ - Memory is disabled in Adaptive modes unless task risk explicitly selects guarded memory.
20
+ - Documentation and plugin guidance now describe efficiency as a measured outcome, not a guaranteed consequence of fewer routed paths.
21
+
22
+ ### Fixed
23
+
24
+ - Prevented file nodes without line ranges from injecting entire source files into Adaptive route-lite contexts.
25
+ - Prevented unrelated recent pitfall entries from being used as fallback memory in guarded packs.
26
+
27
+ ## 0.1.6 - 2026-07-19
28
+
29
+ ### Added
30
+
31
+ - `palace context` / `palace task` as the single task-entry command that initializes, refreshes, routes, and packs context when needed.
32
+ - `palace_context` MCP tool with route and drawer limits for compact agent context.
33
+ - End-to-end tests for one-call context setup on a previously uninitialized repository.
34
+
35
+ ### Changed
36
+
37
+ - Codex plugin, hook, generated guidance, and README now prefer one context call instead of separate status, init, index, route, and pack calls.
38
+ - Context packs produced through the task entry point omit excluded-area narration by default.
39
+ - MCP smoke coverage now requires the new one-call tool.
40
+
41
+ ### Fixed
42
+
43
+ - Reduced repeated agent tool calls and retry opportunities exposed by the A/B benchmark.
44
+ - Prevented routine task startup from spending context on redundant Palace lifecycle output.
45
+
46
+ ## 0.1.5 - 2026-07-18
47
+
48
+ ### Added
49
+
50
+ - `palace evaluate` / `palace eval` command for context-efficiency and route-quality measurement.
51
+ - `palace_evaluate` MCP tool.
52
+ - Persisted Markdown and JSON evaluation reports under `.palace/evaluations/`.
53
+ - Changed-file coverage, route focus, and route-confidence calibration.
54
+ - Build Week development and judging documentation.
55
+ - Windows, macOS, and Linux CI matrix.
56
+ - MCP stdio smoke test using Content-Length framed JSON-RPC messages.
57
+
58
+ ### Changed
59
+
60
+ - Evaluation tasks now route toward the dedicated evaluation subsystem.
61
+ - Scanner and router avoid nested repositories, stale rooms, duplicate source entries, and unrelated fixtures more aggressively.
62
+
63
+ ## 0.1.4
64
+
65
+ - Published the CLI and MCP server through the `vertex-palace` npm package.
66
+ - Added the unique `vertex-palace-mcp-stdio` executable to avoid stale local shim collisions.
package/README.md CHANGED
@@ -2,28 +2,45 @@
2
2
 
3
3
  Memory-palace context routing for Codex.
4
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.
5
+ Vertex Palace turns a repository into a local palace of floors, rooms, cabinets, and drawers. Its Adaptive mode selects the smallest safe context strategy for each task instead of assuming that a full palace pack is always useful.
6
+
7
+ OpenAI Build Week work is documented separately in [BUILD_WEEK.md](./BUILD_WEEK.md), including the pre-existing baseline, submission-period additions, Codex/GPT-5.6 collaboration, and judge verification steps.
6
8
 
7
9
 
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`.
10
+ Name note: `记忆宫殿工具`, `记忆宫殿`, `memory palace`, `palace tool`, and the old name `Context Palace` all refer to Vertex Palace. The preferred MCP entry is `palace_context`; the preferred CLI entry is `palace context`. Lower-level `palace_status`, `palace_index`, `palace_route`, and `palace_pack` remain available for diagnosis and manual control.
9
11
 
10
12
  ## English Overview
11
13
 
12
14
  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
15
 
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.
16
+ It is designed for large repositories, multi-client projects, and long-lived codebases. Run `palace context "<task>" --auto` once to initialize or refresh the local index, plan the route, select a context mode, and report the delivered payload. 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
17
 
16
18
  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
19
 
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.
20
+ 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. Adaptive mode loads memory only for tasks with relevant history, stale-behavior, or tenant-isolation risk, and limits it by scope, age, confidence, and token budget.
19
21
 
20
22
  ## Design Philosophy
21
23
 
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.
24
+ - 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.
25
+ - Correctness before compression: bypass Palace when direct inspection is safer, and widen context when cross-stack or contract risk is detected.
26
+ - Route before reading: plan the most relevant path first, then load primary context while keeping support and deferred references available on demand.
27
+ - 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.
28
+ - Measured payloads: report actual output bytes, estimated context tokens, route tiers, memory items, and guardrails instead of treating fewer file paths as proof of efficiency.
29
+ - Local-first privacy: indexes, route packs, and task memory are generated locally by default.
30
+ - Project memory over time: successful routes, failed routes, client labels, and decisions can be reused by future tasks.
31
+
32
+ ## Adaptive Palace
33
+
34
+ `palace context --auto` chooses one of four explainable modes:
35
+
36
+ | Mode | Selected when | Context behavior |
37
+ | --- | --- | --- |
38
+ | `bypass` | A small repository and one explicit file make routing overhead unnecessary | No source content is packed; direct inspection is recommended |
39
+ | `route-lite` | The task and route are focused with low cross-cutting risk | Loads Primary summaries or symbol snippets; keeps the rest as references |
40
+ | `full-palace` | The task crosses layers, changes a public contract, or has uncertain routing | Loads Primary plus bounded Support context |
41
+ | `guarded-memory-palace` | Prior decisions, stale behavior, or tenant isolation are relevant | Adds only scoped, recent, budgeted memory with contradiction warnings |
42
+
43
+ Adaptive mode reports `contextBytes`, `contextEstimatedTokens`, route-tier counts, memory usage, and guardrails in Markdown and JSON. It is designed to reduce unnecessary preloaded context. It does **not** guarantee lower total agent tokens or faster wall-clock time on every task; those outcomes must be measured end to end with repeated, order-balanced trials.
27
44
 
28
45
  ## Usage Guide
29
46
 
@@ -34,26 +51,26 @@ If you just want the agent to handle it, give your AI coding agent this prompt:
34
51
  ```text
35
52
  Open and read https://github.com/lohchanhin/vertex-palace, install Vertex Palace, then use it in this repository.
36
53
 
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.
54
+ Before working, call palace_context once with my exact task and auto=true (or run palace context --auto if only the CLI is available). Follow the selected mode, expand only when evidence requires it, evaluate the route against the files actually changed, and write task memory after finishing.
38
55
  ```
39
56
 
40
57
  The agent should read the repository instructions, install the plugin or use the CLI, then follow this workflow:
41
58
 
42
59
  ```text
43
- status -> init/index if needed -> route -> pack -> inspect routed files -> implement -> test -> memory write
60
+ adaptive context (one call) -> inspect Primary -> expand Deferred only when needed -> implement -> test -> evaluate -> memory write
44
61
  ```
45
62
 
46
- Before following a route, the agent should read `.palace/00-entrance/pitfall-board.md` when it exists.
63
+ Only `guarded-memory-palace` includes relevant entries from `.palace/00-entrance/pitfall-board.md`; unrelated or old memory is omitted.
47
64
 
48
65
  ### Manual Mode: Step By Step
49
66
 
50
67
  1. Install the plugin:
51
68
 
52
69
  ```bash
53
- codex plugin marketplace add lohchanhin/vertex-palace --ref v0.1.4
70
+ codex plugin marketplace add lohchanhin/vertex-palace --ref v0.2.0
54
71
  ```
55
72
 
56
- Use `v0.1.4` or newer. Avoid `v0.1.0` and `v0.1.1`; those early tags had broken MCP install metadata.
73
+ Use `v0.2.0` or newer for Adaptive Palace. Avoid `v0.1.0` and `v0.1.1`; those early tags had broken MCP install metadata.
57
74
 
58
75
  2. Or install the CLI directly from npm:
59
76
 
@@ -70,15 +87,13 @@ npx vertex-palace status
70
87
 
71
88
  3. Open Codex and install Vertex Palace from `/plugins`.
72
89
 
73
- 4. Initialize and index a repository:
90
+ 4. Prepare task context in one call:
74
91
 
75
92
  ```bash
76
- palace init
77
- palace index
78
- palace status
93
+ palace context "fix login refresh token bug" --auto --budget 6000 --route-limit 8 --max-drawers 4 --out .palace/last-pack.md
79
94
  ```
80
95
 
81
- 5. Before each task, create a route and context pack:
96
+ 5. Use the lower-level commands only when diagnosing or manually controlling the route:
82
97
 
83
98
  ```bash
84
99
  palace route "fix login refresh token bug" --limit 8 --compact
@@ -116,29 +131,44 @@ cat .palace/memory/task-log.md
116
131
 
117
132
  ### Troubleshooting: Agent Does Not Recognize The Tool
118
133
 
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.
134
+ 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 preferred MCP tool is `palace_context`.
120
135
 
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`.
136
+ 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 run `palace context "<task>" --auto`.
122
137
 
123
138
  ## 简体中文说明
124
139
 
125
140
  Vertex Palace 是一个面向 Codex 编程任务的本地上下文路由工具。它会把代码仓库整理成“楼层、房间、柜子、抽屉”的空间结构,让 Codex 在开始修 bug、加功能或理解模块前,先找到最相关的文件与代码片段,而不是每次都从整个仓库重新扫描。
126
141
 
127
- 它适合大型项目、多客户项目和长期维护型项目:你可以先用 `palace index` 建立本地索引,再用 `palace route` 找到任务路径,用 `palace pack` 生成精简上下文包,并在任务结束后写入成功路径、失败路径和决策记忆。所有数据默认保存在本机 `.palace/` 目录中,不上传源码,也不依赖远程向量数据库。
142
+ 它适合大型项目、多客户项目和长期维护型项目:每次任务只要运行一次 `palace context "<任务>" --auto`,工具会自动初始化或刷新索引、规划路线、选择最小安全模式,并报告实际送出的上下文负载。任务结束后再写入成功路径、失败路径和决策记忆。所有数据默认保存在本机 `.palace/` 目录中,不上传源码,也不依赖远程向量数据库。
128
143
 
129
144
  每次路由都会刷新 `.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
145
 
131
- 第一层入口还会有一个踩坑告示牌:`.palace/00-entrance/pitfall-board.md`。当任务写入 `--pitfall` 或 `--failed-attempt` 时,Vertex Palace 会更新这个告示牌,并在后续 context pack 的前段显示它,让 Codex 在读路线抽屉前先看到之前踩过的坑。
146
+ 第一层入口还会有一个踩坑告示牌:`.palace/00-entrance/pitfall-board.md`。当任务写入 `--pitfall` 或 `--failed-attempt` 时,Vertex Palace 会更新这个告示牌。Adaptive 模式只有在任务确实涉及历史决策、旧行为或客户隔离风险时才读取记忆,并按作用域、时间、置信度和 Token 预算筛选。
132
147
 
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`。
148
+ 名称说明:`记忆宫殿工具`、`记忆宫殿`、`memory palace`、`palace tool` 和旧名字 `Context Palace` 都是 Vertex Palace。建议优先使用 MCP 工具 `palace_context`,命令行对应 `palace context`;status、index、route、pack 等底层命令继续保留给排障和手动控制。
134
149
 
135
150
  ## 设计理念
136
151
 
137
- - 空间化理解:把仓库从“文件列表”变成可导航的宫殿结构,让 Codex 可以按功能区域、依赖关系和任务目标定位上下文。
138
- - 先路由,再阅读:先规划最可能相关的路径,再生成有限预算内的上下文包,减少无关文件占用 token。
139
- - 可解释的选择:路由结果会说明为什么选择某个房间、抽屉或文件,方便开发者判断 Codex 是否走在正确方向上。
140
- - 本地优先与隐私优先:索引、记忆和上下文包默认都在本地生成,避免把项目源码交给外部服务处理。
141
- - 持续学习项目习惯:任务完成后记录成功路线、失败路线、客户标签和决策原因,让后续任务可以复用项目经验。
152
+ - 空间化理解:把仓库从“文件列表”变成可导航的宫殿结构,让 Codex 可以按功能区域、依赖关系和任务目标定位上下文。
153
+ - 正确性优先:明确单文件任务可以绕过 Palace,跨层或契约风险则主动扩大上下文。
154
+ - 先路由,再阅读:先规划最可能相关的路径,只加载 Primary 内容,把 Support 与 Deferred 保留为按需引用。
155
+ - 可解释的选择:路由结果会说明为什么选择某个房间、抽屉或文件,方便开发者判断 Codex 是否走在正确方向上。
156
+ - 实际量测:输出真实字节数、估算 Context Token、路线层级、记忆数量和护栏数量,不再用“路径较少”直接等同“效率较高”。
157
+ - 本地优先与隐私优先:索引、记忆和上下文包默认都在本地生成,避免把项目源码交给外部服务处理。
158
+ - 持续学习项目习惯:任务完成后记录成功路线、失败路线、客户标签和决策原因,让后续任务可以复用项目经验。
159
+
160
+ ## 自适应模式
161
+
162
+ `palace context --auto` 会选择四种模式之一:
163
+
164
+ | 模式 | 适用情境 | 上下文行为 |
165
+ | --- | --- | --- |
166
+ | `bypass` | 小型仓库且任务明确指向单一文件 | 不预载源码,建议直接检查目标文件 |
167
+ | `route-lite` | 任务集中、路线明确、跨层风险低 | 只加载 Primary 摘要或符号片段,其余保留引用 |
168
+ | `full-palace` | 跨前后端、公共契约变更或路线不确定 | 加载 Primary 与有限的 Support 上下文 |
169
+ | `guarded-memory-palace` | 历史决策、旧行为或客户隔离确实相关 | 只加入有作用域、有时效、有预算并带矛盾检查的记忆 |
170
+
171
+ Adaptive Palace 的目标是减少不必要的“预载上下文”,不是承诺每个任务的总 Token 与总时间都一定下降。端到端效果必须用相同任务、重复执行、平衡顺序的 A/B 测试判断。
142
172
 
143
173
  ## 使用说明
144
174
 
@@ -149,38 +179,36 @@ Vertex Palace 是一个面向 Codex 编程任务的本地上下文路由工具
149
179
  ```text
150
180
  请打开并阅读 https://github.com/lohchanhin/vertex-palace,安装 Vertex Palace,然后在当前项目使用它。
151
181
 
152
- 开始任务前,请先检查 Vertex Palace 状态;如果还没初始化或索引过,就先 init/index;然后根据我的任务 route,生成最小 context pack,优先阅读路线推荐文件,完成后把改动文件、测试结果、决策和踩坑写入 memory。
182
+ 开始任务前,请针对我的完整任务调用一次 palace_context,并设置 auto=true;如果当前只有命令行,就运行 palace context --auto。按照工具选择的模式行动,只有代码或测试证据需要时才展开 Deferred;完成后评估路线,并把改动文件、测试结果、决策和踩坑写入 memory。
153
183
  ```
154
184
 
155
185
  它应该照这个流程做:
156
186
 
157
187
  ```text
158
- status -> 需要时 init/index -> route -> pack -> 先读路线文件 -> 执行任务 -> 测试 -> 写入 memory
188
+ adaptive context(单次调用)-> 先读 Primary -> 证据需要时再展开 Deferred -> 执行任务 -> 测试 -> evaluate -> 写入 memory
159
189
  ```
160
190
 
161
- 执行 route 前,agent 应该先读 `.palace/00-entrance/pitfall-board.md`,避免重复踩坑。
191
+ 只有 `guarded-memory-palace` 会带入 `.palace/00-entrance/pitfall-board.md` 中与当前任务相关且仍在时效内的记录。
162
192
 
163
193
  ### 勤劳用法:自己一步一步跑
164
194
 
165
195
  1. 安装插件:
166
196
 
167
197
  ```bash
168
- codex plugin marketplace add lohchanhin/vertex-palace --ref v0.1.4
198
+ codex plugin marketplace add lohchanhin/vertex-palace --ref v0.2.0
169
199
  ```
170
200
 
171
- 请使用 `v0.1.4` 或更新版本。不要再使用 `v0.1.0` 和 `v0.1.1`,这两个早期标签的 MCP 安装元数据有问题。
201
+ 请使用 `v0.2.0` 或更新版本来启用 Adaptive Palace。不要再使用 `v0.1.0` 和 `v0.1.1`,这两个早期标签的 MCP 安装元数据有问题。
172
202
 
173
203
  2. 打开 Codex,输入 `/plugins`,安装 Vertex Palace。
174
204
 
175
- 3. 在项目里初始化并建立索引:
205
+ 3. 每次任务前用一个命令准备上下文:
176
206
 
177
207
  ```bash
178
- palace init
179
- palace index
180
- palace status
208
+ palace context "fix login refresh token bug" --auto --budget 6000 --route-limit 8 --max-drawers 4 --out .palace/last-pack.md
181
209
  ```
182
210
 
183
- 4. 每次任务前先规划路线和上下文包:
211
+ 4. 只有排障或需要手动控制时,才分别执行底层命令:
184
212
 
185
213
  ```bash
186
214
  palace route "fix login refresh token bug" --limit 8 --compact
@@ -218,9 +246,9 @@ cat .palace/memory/task-log.md
218
246
 
219
247
  ### 排障:AI Agent 说不认识“记忆宫殿工具”
220
248
 
221
- 如果某个 Codex 线程说不认识“记忆宫殿工具”,通常不是项目坏了,而是那个线程还没有加载 Vertex Palace 插件或 MCP server。中文叫法只是别名,实际工具名是 `palace_status`、`palace_route`、`palace_pack` 等 `palace_*` 工具。
249
+ 如果某个 Codex 线程说不认识“记忆宫殿工具”,通常不是项目坏了,而是那个线程还没有加载 Vertex Palace 插件或 MCP server。中文叫法只是别名,建议它查找并调用 `palace_context`。
222
250
 
223
- 处理方式:先在 Codex 的 `/plugins` 安装并启用 Vertex Palace,按提示信任插件,然后新开一个 Codex 线程或重启 Codex,让 skill、hooks 和 MCP 工具重新加载。如果当前环境只有命令行可用,就让 agent 改用 `palace status`、`palace index`、`palace route` 和 `palace pack`。
251
+ 处理方式:先在 Codex 的 `/plugins` 安装并启用 Vertex Palace,按提示信任插件,然后新开一个 Codex 线程或重启 Codex,让 skill、hooks 和 MCP 工具重新加载。如果当前环境只有命令行可用,就让 agent 运行 `palace context "<任务>" --auto`。
224
252
 
225
253
  ## Install
226
254
 
@@ -240,15 +268,15 @@ npx vertex-palace status
240
268
  Install the Codex plugin:
241
269
 
242
270
  ```bash
243
- codex plugin marketplace add lohchanhin/vertex-palace --ref v0.1.4
271
+ codex plugin marketplace add lohchanhin/vertex-palace --ref v0.2.0
244
272
  ```
245
273
 
246
- Use `v0.1.4` or newer; `v0.1.0` and `v0.1.1` are obsolete because their MCP install metadata was broken.
274
+ Use `v0.2.0` or newer for Adaptive Palace; `v0.1.0` and `v0.1.1` are obsolete because their MCP install metadata was broken.
247
275
 
248
276
  The plugin launches its MCP server through npm:
249
277
 
250
278
  ```bash
251
- npx -y -p vertex-palace@0.1.4 vertex-palace-mcp-stdio --stdio
279
+ npx -y -p vertex-palace@0.2.0 vertex-palace-mcp-stdio --stdio
252
280
  ```
253
281
 
254
282
  Open Codex:
@@ -282,26 +310,49 @@ This creates:
282
310
  Use Vertex Palace before fixing this bug: fix login refresh token bug
283
311
  ```
284
312
 
285
- Codex should route first, pack only the useful drawers, inspect those files, and write memory after the task.
286
-
287
- ## CLI
313
+ Codex should call `palace_context` once with `auto: true`, follow the selected mode, inspect Primary context first, and write memory after the task.
288
314
 
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
- ```
315
+ ## CLI
316
+
317
+ ```bash
318
+ palace init
319
+ palace status
320
+ palace index
321
+ palace context "fix login refresh token bug" --auto --budget 6000
322
+ palace route "fix login refresh token bug"
323
+ palace pack "fix login refresh token bug" --budget 12000
324
+ palace evaluate "fix login refresh token bug" \
325
+ --changed-file src/auth/token.service.ts \
326
+ --changed-file tests/auth.test.ts
327
+ palace doctor
328
+ ```
329
+
330
+ ### Route Evaluation
331
+
332
+ Vertex Palace 0.1.5 adds `palace evaluate` (alias: `palace eval`). It measures whether the route was actually useful instead of trusting route confidence alone:
333
+
334
+ - estimated tokens for all indexed repository text versus the generated context pack
335
+ - token reduction and repository-to-pack ratio
336
+ - changed-file coverage and route focus
337
+ - confidence calibration, including explicit overconfidence warnings
338
+ - persisted Markdown and JSON reports under `.palace/evaluations/`
339
+
340
+ Run it after a task and provide the files that were really changed:
341
+
342
+ ```bash
343
+ palace evaluate "fix checkout shipping bug" \
344
+ --changed-file frontend/app/checkout/page.tsx \
345
+ --changed-file backend/src/shipping/quote.service.ts
346
+ ```
347
+
348
+ Without `--changed-file`, the command still measures context efficiency but marks route quality and confidence calibration as `unverified`.
297
349
 
298
- ### Token-Saving Workflow
350
+ ### Adaptive Context Workflow
299
351
 
300
- For large repositories, write packs to disk and keep the first pass intentionally small:
352
+ For large repositories, let Adaptive Palace choose the first-pass scope and inspect its measured payload:
301
353
 
302
354
  ```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
355
+ palace context "fix checkout shipping bug" --auto --budget 6000 --route-limit 8 --max-drawers 4 --out .palace/last-pack.md
305
356
  ```
306
357
 
307
358
  For multi-client repositories, isolate task memory with a client label:
@@ -318,9 +369,16 @@ palace memory write \
318
369
  --notes "Kept shipping rules configurable."
319
370
  ```
320
371
 
321
- ## Privacy
372
+ ## Privacy
322
373
 
323
- Vertex Palace runs locally by default. It does not upload source code, call external APIs, use embeddings, or create a remote index.
374
+ Vertex Palace runs locally by default. It does not upload source code, call external APIs, use embeddings, or create a remote index.
375
+
376
+ ## Supported Platforms
377
+
378
+ - Node.js 20 or newer
379
+ - Windows, macOS, and Linux are covered by the repository CI matrix
380
+ - Windows is additionally verified through local CLI, npm package, and MCP stdio smoke tests
381
+ - Codex plugin users should start a new task or restart Codex after installing or updating the plugin so its skill and MCP tools reload
324
382
 
325
383
  ## Current Capabilities / 目前能力
326
384
 
@@ -328,11 +386,16 @@ Vertex Palace runs locally by default. It does not upload source code, call exte
328
386
  - Repository scanner with ignore rules
329
387
  - TypeScript, JavaScript, Markdown, JSON, and fallback parsers
330
388
  - Indexes for nodes, edges, rooms, symbols, directory tree, hashes, and routes
331
- - Route planner with task classification, confidence, reasons, and excluded areas
389
+ - Route planner with task classification, confidence, reasons, and excluded areas
390
+ - Adaptive selector with `bypass`, `route-lite`, `full-palace`, and `guarded-memory-palace`
391
+ - Primary, Support, and Deferred route tiers with measured payload metrics
332
392
  - 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`
393
+ - Markdown and JSON context packer
394
+ - One-call `palace_context` / `palace context --auto` workflow with automatic initialization, fresh indexing, mode selection, and bounded packing
395
+ - Route evaluation reports with Token reduction, changed-file coverage, route focus, and confidence calibration
396
+ - Task memory ledger: `latest-task.md`, `task-log.md`, and `index.json`
397
+ - Entrance pitfall board: `.palace/00-entrance/pitfall-board.md`
398
+ - Guarded memory retrieval with scope, age, confidence, risk, contradiction checks, and a 600-token ceiling
336
399
  - CLI
337
400
  - MCP stdio server
338
401
  - Codex plugin folder, skill, hooks, and marketplace metadata