fix(knowledge): stop leaking internal budget symbol into generated skills#80
Merged
Merged
Conversation
…ills
- move resolveKnowledgeTokenBudget to lib/config (canonical single-source
resolver, sibling of resolveBasePaths); check.service imports it
- move KnowledgeSizeBudget interface to types/config (budget contract home)
- agent-sync injects resolved l1_per_file/l2_per_module/readme_max_lines
into the shared skill template context
- knowledge-loading skill templates render budgets from {{...}} variables and
cite .prospec.yaml knowledge.token_budget + `prospec check knowledge-size`
instead of DEFAULT_KNOWLEDGE_TOKEN_BUDGET, which downstream cannot resolve
- align dogfood docs (index.md, README, README.zh-TW, module READMEs) and
regenerate agent skills; re-sync factual test counts
- add contract + unit tests (no-symbol + numbers-from-config), mutation-verified
- graduate REQ-LIB-028 / REQ-AGNT-035 / REQ-TESTS-049 (ADDED) and REQ-TYPES-061 / REQ-SERVICES-065 / REQ-KNOW-013 (MODIFIED) into the drift-detection, agent-integration, and ai-knowledge feature specs - add _archived-history summary; refresh raw-scan.md - harvest lessons: relocation-reference-sweep-completeness → freq 3 (suggest-promote); add typecheck-excludes-tests observation
Prospec Check |
Test Coverage
|
…eck enum) - PB-008: relocating a symbol/type/artifact must sweep every reference site incl. test-file imports (tsconfig excludes tests → type-only import breaks escape typecheck) and wording; freq=3, modules=5 - PB-009: adding a drift check must sync the root-README check enumeration (pnpm counts covers numbers, not that prose list); freq=3, modules=2 - flip both lessons-ledger entries to promoted with provenance
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
問題
prospec agent sync產生、寫入下游專案的SKILL.md(及 AI 依 knowledge-generate 產生的index.md)在說明知識分層 token 預算時,引用了 prospec 套件內部的 TypeScript 常數DEFAULT_KNOWLEDGE_TOKEN_BUDGET。下游專案看不到、也無從解析這個符號,只能看到模板裡寫死的數字;那些數字既不反映該專案在.prospec.yaml覆寫的值,也可能與常數漂移。方案
resolveKnowledgeTokenBudget提升為lib/config的 canonical 單一來源 resolver(與resolveBasePaths同類);check.service與agent-sync皆 import,無 service→service 耦合(PB-006/PB-007)。KnowledgeSizeBudget型別移至types/config(與DEFAULT_KNOWLEDGE_TOKEN_BUDGET/TokenBudget同居)。agent-sync於共用 template context 注入 resolved 的l1_per_file/l2_per_module/readme_max_lines。_knowledge-loading-rulespartial、prospec-knowledge-generate、prospec-knowledge-update)全部預算數字改以{{...}}變數渲染,並將來源改指向下游可見/可執行的.prospec.yamlknowledge.token_budget與prospec check knowledge-size,不再具名內部常數。index.md、README、README.zh-TW、module READMEs)並重新產生 agent skills;pnpm counts同步事實計數。效果
下游讀者看到的是自己專案的實際預算值,權威來源是他們能編輯的
.prospec.yaml與能執行的prospec check knowledge-size——不再是無從解析的內部符號。測試 / 品質
DEFAULT_KNOWLEDGE_TOKEN_BUDGET、數字來自注入 context)與 agent-sync 注入單元測試(override 命中),皆 mutation-verified。pnpm test2086 passed、typecheck/lint綠、prospec check11/11 PASS。import type→ latent TS2459,因 tsconfig 排除 tests 而三閘皆漏)已於 review loop 修復。SDD
透過 Prospec SDD 全流程完成:story → plan → tasks → implement → review → verify(S)→ archive;6 個 REQ 已 graduate 進 drift-detection / agent-integration / ai-knowledge feature specs。