Project Intelligence 使用指南
Retrieval 保留 scripts/retrieval_intelligence.py 作為相容入口;comment/string masking 與 lexical relation row 建構由 scripts/retrieval_relations.py 負責。這些可重建關係只提供候選,不是 canonical Impact Graph 或完整語義。
Project Intelligence 是 AIPS 對既有專案建立的可重用理解層。
第一次 Existing Project
The opt-in docs-only report reads canonical Git paths without writing Project Intelligence; it does not mark a Change Impact record READY.
The Claude Runtime Policy change uses a reviewed direct caller/consumer scope; unresolved lexical matcher aliases remain accepted limitations, and global API/data/event/consumer coverage stays partial.
EPHEMERAL Intelligence and run state remain in external user storage; candidate-bound publication scan evidence is kept in the private AIPS cache.
Project Intelligence 一律存在外部 user state。既有 .ai/ 會保持唯讀;明確 attach/bootstrap 可驗證後複製 legacy Intelligence 到外部,來源保留不變。
診斷的 Recovery Plan 以既有 reason code 提供先後步驟及授權標記。bootstrap/finalize/refresh 是需要已批准任務範圍的衍生狀態操作;diagnose 本身仍不建立、附加或修復專案。
唯讀診斷與恢復
aips project diagnose <project-path> 會聚合 aips doctor、Project Intelligence、目前 Runtime/Harness 設定和本機 MCP 靜態能力,支援 --format text|yaml|json。報告包含狀態、穩定 reason code、結構化 next-actions 及重新驗證命令;缺少/部分/過期狀態會先列唯讀檢查,刷新前標示使用者決策點;BLOCKED 狀態只建議查明原因,不猜測修復命令。診斷本身不會 bootstrap、refresh、建立索引、attach 或修復任何資料。Doctor 原始輸出不會複製到報告。
常見 Project Intelligence 狀態的恢復方式:
intelligence_missing:需要時手動執行aips intelligence bootstrap --project <path>;補足必要語意主題並完成審查後,再執行aips intelligence finalize --project <path>。intelligence_partial:依 status 補足必要語意主題與證據,再 finalize。intelligence_stale:先檢視aips intelligence refresh-plan --project <path>;確認影響範圍後才執行 refresh。- readiness 為
READY且 freshness 為STALE:Context 會保留 stale 狀態,但不單獨阻擋受限的本地 L2 原始碼寫入;只有任務相關主題受影響時才設定refresh_required與targeted_refresh,retrieval_index_required也只在任務需要檢索時為 true;UNKNOWN、非 READY 與其他既有停止條件仍有效。 intelligence_blocked:先處理阻擋原因,不略過 gate。
重新執行 aips intelligence status --project <path> 或 aips project diagnose <path> 驗證結果。Runtime 設定與 MCP 靜態能力不證明 Host 中 Hook/工具確實執行;未取得原生實機證據時維持 UNVERIFIED。
Read-only Discovery 先建立 PARTIAL,再由 Agent 針對 Architecture、Data Flow、Modules、Contracts、DB/Events、Conventions、Testing、Security、Operations 做 evidence-based semantic enrichment;通過 finalize 才是 READY。
Implementation planning may reuse runtime/framework, project rules, toolchain, architecture and API-contract evidence, testing conventions, generated ownership, and nearby examples. Record each source and scope. One local example does not establish a repository-wide rule, and a directory name alone does not prove DDD or Clean Architecture.
Phase 5 的 Widgets 案例可重用的是 OpenAPI client 生成與驗證流程;多個真實產品各自保存 canonical 契約、Profile、產物 ownership 和整合測試。只有新的技術或架構暴露共通缺口,才擴充 AIPS 範例。
不重複正式文件
已有 AGENTS / CLAUDE / GEMINI / ADR / OpenAPI / Architecture Docs / Brand / Visual / Quality Artifact 時,只存 Pointer/Metadata。SOURCE_REGISTRY 同時記錄 Runtime visibility。
Turn Context 依 --target-path 與 Runtime 選取適用指示;根目錄工作不會套用子目錄的 Adapter 範本。--intent read|write 可在語意不明時提供明確任務方向。非 Git 資料夾及尚無首筆 commit 的專案仍可取得基本 Context,歷史查詢則維持不可用。
Turn Context 固定回傳 SYSTEM_CORE.md,並提供不含原始 prompt 的 system_protocol_routes,包含分類、canonical protocol IDs/paths 與解析狀態。Hook 僅顯示這些指標;一般修改的保守回退載入 Orchestrator、Change Impact 與 Quality Planning。必要路徑缺失時修改任務 fail-closed。
Turn Context 另含一行 aips_profile= 顯示目前 profile 開關(預設 strict);該行只回報開關名稱與原因碼,不改變 Intelligence 準備、刷新或 Change Impact 的判斷。
四份核心 Machine-readable 檔
PROJECT_INTELLIGENCE.yaml:Identity / Branch / Worktree / State / Topic pointers。SOURCE_REGISTRY.yaml:Authoritative source / Scope / Hash / Runtime visibility。IMPACT_GRAPH.yaml:API / Module / DB / Event / Consumer graph。PROJECT_OVERRIDES.yaml:使用者核准、補充、例外、排除、Conflict。
三軸狀態
readiness: READY | PARTIAL | BLOCKED
review: UNREVIEWED | REVIEWED | CHANGES_REQUESTED
freshness: CURRENT | STALE | UNKNOWNHuman Review HTML
Review HTML 位於 AIPS External State;HTML self-contained、deterministic,只是 Review View。
Freshness
OpenCode V2 derives Project Intelligence from the active Session.Info.location.directory, limits transient Context to 12,000 UTF-8 bytes, and rechecks it against the native write target.
aips intelligence refresh-plan --project <project> returns affected topics, changed source hashes and manual review steps without writing state. Review sources and update only reviewed registry hashes before finalize. Finalize records computed freshness rather than hiding stale authoritative sources. Repeated bootstrap preserves existing Intelligence and points to refresh-plan; workflow files appear as CI graph seeds with partial semantic coverage.
不是任何 Commit 都全量 STALE。AIPS 比較 relevant Source Hash、watched paths、HEAD diff、dirty paths、Branch/Worktree 與 Schema,只 Targeted Refresh 受影響 Topic。
Git 路徑以 NUL 分隔讀取,完整變更集合用於新鮮度判斷;畫面清單可截斷並標示總數。若 Git 掃描失敗、逾時或超過輸出上限,狀態為 UNKNOWN,變更工作須先排除原因,不能當成 CURRENT。
aips intelligence refresh 只處理 squash/rebase 後的 equivalent-tree revision reconciliation:工作樹必須乾淨,且舊/新 tree object 完全相同。內容不同時回報 SEMANTIC_REFRESH_REQUIRED,不覆寫 topics。
任務層 freshness 只有在選取的 topic/component 路徑都能映射,且所有受影響 topic 都已知並與選取範圍不相交時,才可證明不相關。沒有選取 topic、source registry 改變、未知影響或路徑無法映射時,回報 STALE/UNKNOWN;mutation 仍依全域 freshness 封閉。
Core capsule 目標上限為 1,600 tokens,Recall 為 6,000,組裝總估值為 7,600。組裝前先預留時序資料與 topic 指標所需空間,再把剩餘預算交給本機檢索;時序資料或檢索結果超量時會明確標示截斷。估值採 deterministic 字元估算,並非特定模型 tokenizer。Runtime hook 會再次量測最終文字輸出並裁切可選內容,保留 freshness、retrieval status 和來源摘要。
CLI 預設 YAML 只顯示精簡 Context;--full 可查看完整診斷,JSON 格式保留機器可讀的完整結構。full_manifest_characters 是完整序列化字元數,不是模型 token 數。
Architecture 摘要、核准覆寫與時序文字在進入 Runtime Context 前共用 Runtime Content Safety Boundary。檢索索引不可用時回報穩定錯誤類別與修復指引,同時保留 canonical source pointers。讀取快取受限時會嘗試經驗證的唯讀快照;索引落後目前 revision 時的自動刷新需要 SQLite 快取目錄可寫(含 sidecar 檔)。若沙盒只允許讀取,應為目前 Runtime 指定可寫的 XDG_CACHE_HOME 或在可寫 Runtime 中刷新索引;診斷會明確指出寫入需求,不會將舊索引標示為最新,也不會因一般寫入拒絕就要求強制重建。
Attach / Detach
Skill frontmatter 為 routing source,INDEX 為 generated view;Intelligence 保留 source pointers,EPHEMERAL 仍使用 external cache。
Attach/bootstrap 將 legacy Intelligence 驗證後複製到 External State;來源 .ai/ 不會被改寫或封存。
Change Impact
Publication impact is bound to the selected worktree and committed candidate SHA; unrelated uncommitted files are diagnostic context only and do not alter the candidate diff or scan evidence.
Scenario 266 records content-safety verification while preserving existing maintenance and publication authority boundaries.
Plan38 records the publication authority, Doctor, snapshot and Claude Hook callers; the repository-wide Impact Graph remains partial and the scoped paths were manually reviewed.
Publication changes retain the recorded bounded traversal and direct consumer review; repository-wide API, data, event and consumer graph coverage remains partial and must not be inferred from the local path graph.
High-risk Change Impact can preserve separate caller and consumer reports as a version 2 scoped bundle. Each direction keeps its own hard budgets and original status; separate node reviews bind every non-seed node to the exact report and node digests. Every unresolved lexical finding needs a matching report/finding digest, current source evidence and explicit Human approval as a reviewed limitation before implementation approval. This does not mark the finding resolved or upgrade global graph coverage.
Publication prepare/diagnose observations remain read-only and worktree-bound; follow the canonical Git publication procedure in USER_GUIDE.md and preserve native authority, candidate validation and host permissions.
The creative workspace import review uses a seed-scoped graph for the profile, CLI, and direct test consumers; repository-wide graph coverage remains partial/unknown.
創作修正 Change Impact 涵蓋 native prompt admission、Profile-to-prompt、manifest/image hashes、版本化 lineage、CLI/tool consumers 與品質證據。缺陷更新寫入新版 Profiles,歷史來源仍可驗證;局部 caller review 不提升 global graph coverage。
Publication-authority changes include hook consumers, remote identity resolution, candidate scanning and documentation. Change Impact evidence describes the affected boundary; it does not grant push, PR, or merge authority.
Publication authority impact 包含 shell AST、Git common/worktree identity、legacy runtime-policy consumer、外部 issuer 與 ledger。Scoped manual consumer evidence 不升級全域 Impact Graph 覆蓋;signed grant 也不替代 Intelligence readiness。
Disposable Retrieval index version 6 會重建舊的 symbol inventories;資料表介面與使用者 Canonical Intelligence 不變,舊索引不能作為本次關係修正的可信證據。
Python symbol discovery 不再把一般函式呼叫當成宣告;explicit top-level module-object re-export 可追到其實作。這減少假的 ambiguous target,關係仍維持 lexical candidate,不推論任意物件方法。
impact-candidates --max-depth 2 或 --max-depth 3 可探索候選的相鄰 import/consumer;輸出保留 candidate confidence、來源行號及未知關係。候選不會寫入 Canonical Graph,也不能替代高風險 Change Impact 的審查。
For creative changes, manually reviewed CLI, OpenCode, provider, profile, validation and documentation consumers remain scoped evidence when the Impact Graph has no mapped edges; do not claim repository-wide completeness.
Creative execution changes review the OpenCode prompt-admission path, CLI policy/execution modules, local provider boundary, lifecycle consumers and documentation. A scoped review does not upgrade repository-wide partial Impact Graph coverage.
Repository-wide graph coverage remains partial; inspect affected inputs, outputs, events and consumers and do not infer complete coverage from scoped retrieval.
aips intelligence impact-candidates --seed-path <path> reports bounded, source-backed relationship candidates from Python imports, literal CLI dispatch, test imports and documentation placement. It is read-only: candidates remain unreviewed, dynamic relations stay unresolved, and repository-wide coverage remains partial/unknown.
For OpenCode Creative mutations, Project Intelligence and Turn Context may inform routing but do not authorize writes; the grant comes from the current native user prompt and is bound to the active Session root.
Project Diagnostics 的 PI reason code 只提供建議;必須由使用者明確執行 bootstrap、refresh 或其他修復,且仍需遵守 Change Impact target scope。
創作分類附帶 advisory creative_medium(raster/vector/unspecified),供 OpenCode 檢查媒材不符;分類欄位不是執行授權。native tool 另確認使用者要求與取消狀態,保持唯讀預檢可用。
Creative executor changes are reviewed across CLI dispatch, OpenCode tool registration, Bundle/profile inputs, output manifests, trace consumers, Scenario coverage, and documentation projections.
The versioned prepare action adds create-only Profile/Bundle outputs to this boundary; its model/runtime/license fields remain unconfigured until the project selects an installed local engine.
OpenCode resolves Context from the active Session project root and rechecks current Intelligence at supported native file targets; implementation still follows the approved Change Impact boundary.
OpenCode V2 consumes the compact Context Manifest on each primary dispatch and rechecks current readiness for supported direct file actions; this runtime check does not replace project-level Change Impact before implementation.
OpenCode 以 --runtime opencode 解析既有 Project Intelligence 與 Change Impact;managed 指示投影不覆蓋有效的 project-native conventions。
Shared canonical hash/path/glob helpers preserve the existing Project Intelligence matching facade. Bounded source traversal still records unresolved edges and does not claim repository-wide completeness.
Promotion eligibility 與目標路徑限制已抽至 project_intelligence_promotion.py;原 facade 保留相容入口,Human approval 與禁止覆寫既有檔案的界線不變。
Project Intelligence 的 atomic text/YAML storage 與 writer locking 已拆至 project_intelligence_storage.py;公開 facade、匯入物件身分與既有行為維持相容。
Standalone and shadow dependency-review artifacts retain exact base/head, run ID, actual JSON findings and outcome for 90 days. Parity compares canonical findings; missing outputs, different candidates or inaccessible artifacts stay UNKNOWN. Job success alone cannot promote the shadow. Record resolved toolchain fingerprints and repeat full Gates only for new changes or unresolved failures.
Changes to a shared Python workflow bootstrap must reconcile every caller, declared requirement file, tested constraint, import profile, and lifecycle test.
The shell CLI impact boundary includes the public bin/aips launcher, the resolved-checkout scripts/aips_cli.sh facade, its source modules, and direct CLI contract and install/update lifecycle consumers. The shell call graph remains a manually reviewed partial graph.
Temporal query 的實作抽至 scripts/project_intelligence_temporal.py;scripts/project_intelligence.py 仍保留同一 facade 函式與 CLI 路由,Scenario 204 驗證其 identity 和輸出。
Validation-scope metadata is advisory while every Gate still runs the complete validator set. Impact traversal reports scoped callers and consumers; stale retrieval indexes remain an explicit incomplete-evidence condition.
Repository validation-scope metadata can refine candidate-path planning, but current execution remains full-run shadow and does not alter Project Intelligence consumer closure or impact confidence.
Architecture-impact traversal is kept behind project_intelligence.py as a compatible internal module; existing callers keep the same function and evidence shape. Retrieval structural graph construction follows the same facade boundary. These extractions preserve indexed evidence, bounded traversal and explicit unknowns.
Python caller impact uses the rebuildable schema-v8 target-path index to select known exact-path candidates before unresolved candidates. Known other-module paths and declared external imports do not consume the budget; uncertain targets remain bounded and fail closed. Traversal counts at most min(max_edges × 10, 3,000) candidates; one extra sentinel may be read to detect overflow but is excluded from the counter. Reaching the limit reports TRUNCATED rather than implying complete caller coverage. Older disposable indexes are migrated and fully rebuilt.
OpenAPI generator executable/version, declared tool inputs and generated ownership are project-local implementation evidence. Keep them in the Implementation Profile and Phase 3 provenance records; do not promote one project's generator choice into reusable global Project Intelligence. Scenario 196 defines the local execution and rollback boundary.
Project Intelligence can locate OpenAPI specifications and likely consumers, but presence in the repository does not establish contract authority. Implementation Resolution records whether the source is canonical, descriptive, proposed or unresolved before compatibility evidence is used.
Phase 3 的 Implementation Enforcement 只依選定 Profile 的明確路徑範圍檢查目前候選差異。Project Intelligence 提供候選來源與 consumer 線索,但仍須由 Profile 指定權威契約、輸入、生成輸出與品質命令;未知 ownership 或過期證據會阻擋強制模式,不可由檢索結果推定已驗證。
CI、publication preflight 與 documentation trigger policy 的變更,應一併預覽遞迴文件閉包,並以最終差異重新綁定 Core Change Test Matrix。
Python runtime-floor changes also require manual review of shell interpreter selection, managed install/update repair, doctor, canonical facts, CI workflow consumers, tests and docs when Impact Graph traversal is partial or truncated.
Mutation 前建立 CHANGE_IMPACT,涵蓋 Input / Output / Data / Events / Consumers / Security / Invariants / Compatibility / Tests,完成範圍審查並記錄使用者授權後進入 IMPLEMENTATION_APPROVED。unknowns 可保留舊字串格式,但舊字串仍視為未解並阻擋核准;新的結構化項目記錄 id、描述、OPEN / RESOLVED / MITIGATED / ACCEPTED_LIMITATION、處置說明、可驗證證據與 Human review。已處置項目必須提供仍有效且位於 repo 內的檔案 SHA-256 證據或符合相同 scope 的 traversal digest,以及 reviewer: human、核准參考與時間。OPEN、缺漏、過期、越界或 scope 不吻合時仍 fail closed。Seed-scoped traversal 只支援該範圍的判斷,不能把全域 graph coverage 改成 complete。
這只允許依核准範圍實作。READY 僅能在實作後記錄完整 base/head SHA、乾淨工作樹、binary diff SHA-256、精確變更檔案集合與 target_paths,並完成 Impact Graph 核對及證據。以 aips intelligence impact-validate --project <repo> --path <artifact> 驗證;digest、HEAD、路徑集合不吻合或不可驗證時拒絕 READY。未解影響不得標記 READY。
當全 repository 圖譜尚未完整,但某個明確架構邊界已依來源核對,可在 IMPACT_GRAPH.yaml 使用 coverage_scopes 記錄 seed、各維度覆蓋狀態與證據。它只適用於完全落在該範圍內的 seeds,不能把全域 partial coverage 改成 complete;seed 不相符或證據格式無效時仍維持 unknown。
需要 traversal 時,先以 aips intelligence impact-traverse --project <repo> --seed <symbol> --seed-path <path> --risk-class <class> 找候選 callers/consumers。風險政策設定最低深度;node、edge 與 depth 都有上限。結果會區分實際修改與受影響但未修改的節點,後者必須記錄 reviewed_safe、requires_change 或 unknown。依賴注入、反射、動態 dispatch、圖涵蓋不足、索引過期與預算截斷都保留為不確定性;高風險 change 有 unresolved 或 truncated 證據時不得標記 traversal 完整。Lexical 關係是 inferred evidence,需人工核對。
若 impact-validate 指出節點缺少 final disposition,依錯誤中的路徑檢視 caller/consumer,再明確選擇允許值並重跑驗證;不會根據沒有程式碼差異就自動標成安全。
- For release-policy changes, declare readiness inputs, the changelog invariant, read-only consumers, and the documentation closure before implementation.
Publication Change Impact includes API evidence, CLI routing, authority diagnostics, hook consumers, PR observations, and the documentation/test closure. This run-local impact does not create persistent project policy.
Preserve Valid Native Conventions
Explicit Rule → Formatter/Linter/Contract → Shared Abstraction → Majority Convention → Approved Intelligence → Framework Best Practice → AIPS Default。Unsafe/broken legacy pattern 不盲目複製。
Sensitive Data
Reusable Skills describe methods only. Project-specific game rules, telemetry, participant research notes, credentials, and private playtest data stay in the owning project and must not be copied into global Skills or shared references.
Intelligence / HTML 不保存實際 Password、Token、Private Key、Secret env value、Credential 或不必要的敏感 Payload。
Monorepo
採 System-level + Target Component + Shared Impact relationships 的 Lazy Load,不因整體理解就載入所有 Component。
Retrieval Intelligence:即時按需檢索
Relation extraction behavior is tied to the disposable index schema version. A behavior change increments SCHEMA_VERSION to rebuild unchanged files and remove stale edges. Syntax-sensitive parsing uses raw source only in memory; persisted chunks and relation candidates remain redacted.
查詢與索引建置使用不同 SQLite 開啟路徑。唯讀環境無法開啟 WAL shared memory 時,不論失敗發生於建立連線或首次查詢,只要沒有待套用的 WAL 且來源在複製期間維持穩定,AIPS 可使用經完整性檢查的暫時快照;仍無法安全讀取時會回報索引不可用,先檢查 runtime 對快取的讀取權限與 sandbox 限制,再考慮重建,不推測索引已損壞。
Project Intelligence 不再只依賴預先整理好的 Topic。AIPS 保留原本的穩定理解層,同時加入一個可以隨時重建的 Retrieval Intelligence 快取。
穩定 Project Intelligence
Architecture / Impact Graph / Source Registry / Overrides
+
即時 Retrieval Intelligence
Code / Symbol / Test / Git History
↓
只挑本次任務需要的內容例如修改退款邏輯時,系統可以優先帶入退款實作、相關測試、Impact Graph 關聯與過去相關 commit diff,而不是先把整個 orders 目錄或所有 Architecture Topic 塞進 Context。
目前核心採 Local-first Hybrid Retrieval:
- SQLite FTS lexical search;
- 程式 symbol 定義比對;
- test evidence 加權;
- Impact Graph 關聯加權;
- Git commit / diff history;
- Token Budget 限制。
Semantic/Embedding Provider 是可選擴充,不是必要依賴。沒有設定時會誠實標記 NOT_CONFIGURED,仍使用本機 deterministic / structural retrieval,不會假裝已做 embedding semantic search。
實際 index DB 放在 AIPS cache,屬於可刪除、可重建資料;RETRIEVAL_INDEX.yaml 只記錄版本、workspace、revision、provider 與 coverage,不會取代 repository code 或 Project Intelligence 成為 Source of Truth。
Temporal Project Intelligence 另外以 TEMPORAL_ASSERTIONS.yaml 保存具 provenance、observed metadata 與 supersession 的架構事實。Git revision ancestry 是有效期間的權威時間軸;一般工作仍走 Current Snapshot,只有歷史、backport、release branch 或 evolution 問題才使用 CURRENT、AS_OF、BETWEEN、WHY temporal query。未知歷史維持 UNKNOWN,不由 migration 猜測。
每個結果會保留 path + line(或 commit)、content hash、Git HEAD / dirty fingerprint,並先排除 credential / secret path、限制最大 Context Token。
SQLite schema creation, metadata access and read-only index snapshots are implemented in scripts/retrieval_storage.py. scripts/retrieval_intelligence.py remains the stable facade and re-exports these helpers; live-WAL refusal, source-stability checks and snapshot integrity behavior are unchanged.
Retrieval Quality Evaluation:先量測,再決定下一項技術
AIPS 不會因為「Vector DB、Embedding、Tree-sitter、LSP 或 Sourcegraph 看起來更進階」就直接導入。下一步先使用 repository-specific benchmark,對照:
v0.20-style Static Topic Context
vs
v0.21 Local Hybrid Retrieval
↓
Precision@K / Recall@K / F1@K / MRR
Git History Recall
Irrelevant Context Rate
Token Usage
Observed Latency其中 Static Topic baseline 是可重現的「v0.20-style」比較基準,不宣稱能逐字重建所有歷史 v0.20 Agent Turn。Benchmark 評的是「本次工程任務能否取得正確 repository evidence」,不是 Agent 整體任務品質。
Suite 會明確列出每個案例的 expected source paths、可選的 history term、baseline topic files、Top-K、Token Budget 與門檻。Benchmark 控制資料應放在 indexed product source 之外,避免 expected answer 本身被 FTS 找回而污染評估。
Case 另外分成:
- required:核心 regression gate;任何 threshold 失敗都會讓 evaluation / CI FAIL。
- diagnostic:刻意挑戰目前能力邊界的 stress case;仍會誠實保留 FAIL 與各 metric,但只記成 diagnostic gap,不會為了它直接阻擋 release,也不能把 FAIL 改寫成 PASS。
Diagnostic case 會標註 dimensions,例如 Go / TypeScript、monorepo/shared module、low lexical overlap、synonymy、cross-file call chain。Report 會彙總 gap IDs、gap dimensions 與 failed checks(例如 recall、history、context purity);只有當某一類 gap 持續出現,才有足夠 evidence 討論 Tree-sitter/LSP、Embedding 或 Sourcegraph。
系統另外區分:
- reference recall:Topic 有提到某個 source path;
- direct source recall:實際把該 source evidence 取回 Context。
因此不會把「summary 裡有寫到檔名」誤算成已取得真正程式碼 evidence。
Latency 只記錄 observed value,不作為共享 CI 的 pass/fail 門檻;避免 runner 負載造成假 regression。Result fingerprint 只綁定 suite、repository revision / dirty state、deterministic metrics/checks 與 authority boundary;observed latency、machine-local path、index timestamp 不進 fingerprint,因此相同 evidence 不會因 runner 速度不同而變成另一份證據。
aips intelligence evaluate \
--project /path/to/project \
--suite retrieval-evaluation.yaml \
--output retrieval-report.jsonBenchmark 結果只是 evidence。它不會自動開啟 semantic provider、不會自行改 ranking 權重,也不會替 Human 決定下一步要使用 Tree-sitter/LSP、Embedding 或 Sourcegraph。
Structural Retrieval:已採用的跨檔關係檢索
Structural Retrieval 已在 controlled Trial 通過 full corpus 並取得 Human Adoption Decision,因此現在成為正常 Retrieval Intelligence 的預設 lane。
Exact Query Symbol
↓
Lexical Index 找引用它的 Bridge
↓
Bridge 內其他 Exact Identifier
↓
Indexed Symbol Definition
↓
Target Definition / Related Test例如查詢只知道 CheckoutCoordinator 與「downstream allocation / rollback」,系統可以先找到 wiring file,再沿 wiring 中的 exact identifier 找到 inventory reservation definition,不需要 query 直接寫出 ReserveStock。
正式採用仍維持幾個邊界:
- Bridge discovery 使用既有 lexical index,不做無限制全庫掃描;
- target resolution 使用 indexed symbol table;
- bridge / identifier / target / test scan 都有 hard limit;
- retrieval evidence 會顯示 structural telemetry 與是否發生 truncation;
- 不新增 Tree-sitter、gopls/LSP、Sourcegraph 或 remote semantic dependency;
- 這是 exact-identifier relation graph,不宣稱 compiler-grade semantic resolution;
- Turn Context 與一般
aips intelligence retrieve預設啟用; - debug / regression 可用
--no-structural明確關閉; - Scenario 130 仍保留 explicit OFF/ON Trial replay;
- Retrieval Quality Evaluation 會量測目前已採用的 default behavior。
Semantic Alias Expansion Candidate Trial:HOLD
Structural Retrieval 採用後,AIPS 先測了一個不需要 Embedding / Vector DB 的 deterministic alias expansion 候選,希望處理 low lexical overlap / synonymy。
這次完整 9-case corpus 的結論不是 PASS,而是 FAIL / HOLD:
auth-token-expiry、Go receipt reconciliation、TypeScript session refresh 三個 required case 出現 regression;- 原本 registration diagnostic baseline 已經 Recall@K=1.0,但 alias candidate 反而降低 source recall;
synonym-access-rotation仍沒有 source-recall 改善;- 真正 semantic provider 全程仍正確顯示
NOT_CONFIGURED。
因此這個 alias candidate 不採用、不進 Turn Context default。Scenario 132 會刻意重播這個失敗結果,要求 Trial 回傳 HOLD,避免後續只靠調權重把負向 evidence 洗成 PASS。
如果後續還要處理 semantic gap,下一個候選必須是 materially different 的方案,例如真正的 embedding / semantic provider;但開始之前需要另外做 Human review,明確決定 source-code 是否可送往 provider、使用 local 或 remote embedding、成本/快取/隱私/fallback 邊界。Scenario 132 不會自動啟用任何 provider。
Remote Embedding Retrieval Trial Readiness(Scenario 133)
AIPS 接著準備真正的 remote embedding Trial,但仍然不改正式 Turn Context。
第一版 Trial 只允許傳送 synthetic Retrieval Quality fixture,不允許傳 AIPS repository / product source。Credential 沿用 protected CI secret reference,不寫進 source、log 或 report。
Synthetic 9-case corpus
↓
正式 Retrieval baseline
↓
Remote Embedding candidate
↓
In-memory cosine ranking
↓
同一套 retrieval metrics
↓
PASS / FAIL / TRIAL_PENDING / TRIAL_BLOCKED邊界:
- 正常 PR / main CI 不呼叫 remote embedding;
- 只有專用 Trial branch 或手動 workflow dispatch 才會嘗試;
- 沒有
OPENAI_API_KEY→TRIAL_PENDING; - provider/network failure →
TRIAL_BLOCKED; - request、candidate chunks、remote characters 都有 hard limit;
- 不新增 Vector DB,向量只在 Trial runtime 暫存;
- 正常 Retrieval / Turn Context 仍完全不啟用 embedding lane;
- production source transfer 維持 false;
- 即使 Trial PASS,也只能進 Human Adoption Decision,不能自動採用。
第一個 adapter 使用 OpenAI embeddings endpoint,預設 model 為 text-embedding-3-small;model 可以用 repository variable 覆寫,但 provider 不因此成為 AIPS 必要依賴。
如何完成真實 Provider Trial
Dedicated workflow 會把 machine report 轉成 GitHub Job Summary,因此 workflow 顯示 SUCCESS 不代表 Trial 已 PASS。
操作順序:
- 在 repository 的 GitHub Actions secrets 配置名稱為
OPENAI_API_KEY的 repository secret;不要把 key 寫入 repository、Issue、PR 或 log。 - 如需覆寫預設 model,可設定 repository variable
AIPS_RETRIEVAL_EMBEDDING_MODEL;沒有設定時使用text-embedding-3-small。 - 重新執行
retrieval-semantic-trialworkflow。 - 直接查看 Job Summary:
TRIAL_PENDING:credential 仍不可用,provider 未執行;TRIAL_BLOCKED:provider/network/config 有阻塞,維持 HOLD;FAIL:品質不達標,保留負向 evidence,不採用;PASS:只代表可以進 Human review,仍不能自動啟用 embedding。
- 只有
PASS且 Human 明確做出 Adoption Decision 後,才可另開正式 adoption change。
目前 normal Retrieval / Turn Context 與 production source-transfer policy 在上述流程中都不會改變。
Provider-Neutral Local-First Embedding Trial(Scenario 134)
Scenario 133 的 remote adapter 與安全邊界保留,但不再把 remote credential 當成 semantic research 的預設前置條件。Scenario 134 將 embedding Trial 改成 local-first / remote-optional:
Synthetic 9-case corpus
↓
正式 Retrieval baseline
↓
Provider selection
├─ local(default)→ pinned BGE model → runner-local inference
└─ remote(optional)→ OpenAI-compatible embeddings
↓
In-memory cosine ranking
↓
同一套 retrieval metrics / thresholds
↓
PASS / FAIL / TRIAL_PENDING / TRIAL_BLOCKED
↓
Human Adoption Decision(PASS 也不自動採用)預設 local provider:
- runtime dependency:pinned
sentence-transformers; - model:
BAAI/bge-small-en-v1.5; - model revision:固定 commit,不追隨 mutable
main; - dimensions:384;
- 不需要
OPENAI_API_KEY; - 第一次 Trial 可從 Hugging Face 下載 model artifact,但 query / fixture embedding inference 在 GitHub Actions runner 內完成;
HF_HUB_DISABLE_TELEMETRY=1;- repository/product source transfer 仍為 false;
- model download/load/inference failure →
TRIAL_BLOCKED / HOLD。
Remote provider 仍可透過 AIPS_RETRIEVAL_EMBEDDING_PROVIDER=remote 顯式選擇。只有這條 optional path 才需要 OPENAI_API_KEY;若缺少 credential 仍誠實回 TRIAL_PENDING。
正常 PR/main validation 不安裝 semantic Trial dependency、不下載 model、不執行 embedding;dedicated retrieval-semantic-trial 才安裝 requirements-semantic-trial.txt 並執行真正 embedding benchmark。
Scenario 134 不改 production Retrieval / Turn Context。Local Trial PASS 也只代表 evidence eligible for Human review;production embedding lane、cache、source-transfer policy 與 default enablement 都仍需另外 Human Adoption Decision。
Debug
一般使用不需執行;排錯可用 aips intelligence status/render/finalize/impact-init/index/retrieve/evaluate。
impact-init 若遇到既有 change ID 會拒絕覆寫並顯示原紀錄位置與狀態。新的變更請用新 ID;確定要重新建立時才加 --reset,原 YAML 會先存成同目錄的時間戳備份,輸出會列出 backup_path。
Identity namespace
Project Intelligence follows orchestration/PROJECT_IDENTITY.md. EPHEMERAL storage is workspace-scoped by canonical workspace_id; repository-wide writer coordination belongs to the isolation layer and uses repository_id.
Runtime Content Safety Boundary
A docs-only classification continues to require content scanning, Human approval, and exact Change Impact reconciliation.
Change Impact evidence records only the reviewed direct boundary; unresolved lexical aliases remain explicit and do not upgrade global coverage.
A literal git -C <path> push directs candidate and scan binding to the resolved target worktree; dynamic or unavailable paths fail closed before content is inspected.
Publication command normalization maps -u / --set-upstream plus the checked-out branch to the observed full HEAD SHA and full ref; the resulting candidate still passes the existing content scan and publication authority checks.
JSON-mode publication errors expose only stable, allowlisted diagnostics; they neither serialize raw exception details nor replace the final candidate/history scan.
Publication recipe diagnostics are static text; they never echo commands and do not replace the final candidate/history scan.
The publication Hook may reuse only a short-lived, integrity-checked record of a prior full scan. Candidate, repository/worktree, remote tip, target, diff, scanner or policy drift invalidates it; the record never replaces final candidate/history scanning.
Candidate scanning reads the final tree and all commits in base..head; provider-token and private-key detection remain enabled. JSON text is scanned up to 8,000,000 bytes, while other text retains a 2,000,000-byte bound; an oversized or incomplete scan blocks publication. WebM has no path exceptions: bounded EBML parsing scans declared text metadata, skips media payloads, and blocks malformed, unsupported unknown-size structures, invalid metadata text, or files over the configured 32 MiB default.
Dynamic ComfyUI workflow JSON and imported workflow files are project content, not Project Intelligence instructions or canonical capability truth. Review them within the exact project Change Boundary; only runtime schema and inventory observations can establish current local compatibility, and scoped evidence does not upgrade repository-wide graph coverage.
Publication recovery remains a read-only observation: retryable remote Hook failures return immediately with manual Doctor guidance; Prepare timeout diagnostics expose only stable codes, phase and allowlisted error class. These observations do not grant publication authority.
Plan44 records bounded manual caller and adapter evidence where the repository graph lacks publication nodes; this does not promote repository-wide graph coverage or change publication authority.
Publication hook 發生未預期內部例外時保持 fail closed;診斷只提供 allowlist 類別與安全識別資料,禁止將例外本文寫入 Intelligence。
Plan45 scanner diagnostics remain runtime publication observations and are not persisted as Project Intelligence facts. Their stable reason and phase identify recovery needs without recording exception text, candidate paths, or secret values. Plan42 的 scoped Change Impact 覆蓋字型解析器、staged Hook/CLI、publication preview、候選歷史掃描、依賴與 Scenario 263;全域 Impact Graph 仍是 partial,不推論為完整。
Commit safety reports only a stable reason, phase, category/detector, Diagnostic ID and a sanitized relative file when safe. The Hook and read-only diagnostic CLI share the scanner; findings do not persist matched content or change publication authority. Scenario 265 adds bounded AVIF metadata inspection without changing Project Intelligence persistence or freshness.
Publication scanning excludes only validated numeric Git index/mode metadata; paths, added/removed/context lines and unknown headers remain scanned. Branch deletion verifies GitHub RS256 issuer, repository, protected main, workflow SHA, dispatch event and a proposal-bound audience. Runner flags alone grant no authority; tokens remain in memory.
明確的 XDG_CACHE_HOME 會原樣保留。預設快取不可寫時,AIPS 可使用目前使用者擁有、權限為 0700 的可重建暫存快取;symlink 與其他使用者擁有的快取會拒絕。外部 Intelligence metadata 不可寫時,可重建 metadata 保存在快取旁並回報 CACHE_ONLY;索引 freshness 仍由實際候選比對,canonical 來源與 graph 不會被替代。資料庫被清理後,保留的 metadata 只回報 MISSING/ORPHANED;執行 aips intelligence index --project <path> 即可重建,不需 --force。
Run Dashboard projections consume only sanitized, allowlisted operational facts; prompts, reasoning, raw output, secrets and raw workspace paths remain excluded.
Project Intelligence outputs are AIPS-owned durable content and must pass the Runtime Content Safety Boundary before persistence. Secret findings remain fingerprint-only and never include the detected value.
Git commit diagnostics retain stable rule and finding fingerprints, safe file/line evidence and next-step guidance. Injection is evaluated on changed staged lines; Secret and PII scanning stays full-blob. An ambiguous finding is not an implicit allow, and a narrow expiring exception remains separate from Human publication authority.
Publication guard classification changes do not change Project Intelligence inputs, storage or authority.
The pii.email.v2 Git remote grammar changes only commit and publication PII findings; Project Intelligence inputs, storage and authority are unchanged, and redacted context still removes real addresses.
純依賴升級文件豁免(Scenario 221):scripts/dependency_impact.py 的 pure_dependency_update 只在候選 diff 的每個檔案都是允許清單內的依賴清單(.github/workflows/*.yml、根目錄 requirements*.txt、constraints/*.txt)、且每一組變更行都只是同一個 action 的完整 SHA 釘選更新(版本註解不得降版),或 name==version 的嚴格升版時,判定為 PURE_DEPENDENCY_UPDATE。此時 Documentation Impact、Documentation Placement 與 Documentation Sync 只豁免文件要求,並在報告列出每個依賴的分類、風險與 human_review_required;混入任何其他行或檔案、降版、未釘選參照、規劃路徑、超過大小上限或判定失敗,一律回到完整規則。秘密掃描、內容安全、Core Change Test Matrix、Integration Gate、必要檢查與人工合併核准都不變,automatic_merge_authorized 仍為 false。
Dependabot commit 的機器人 noreply author 與最後一行精確的 Signed-off-by trailer 屬於 Git 身分 metadata,由 config/git-publication.yaml 決定,不是 PII 例外;pii.email.v2 與其他位址仍會擋下,機器人身分不授予權限。
Publication authorization is separate from Project Intelligence freshness: AIPS Required Checks enforcement is opt-in via AIPS_ENFORCE_REQUIRED_CHECKS=1; GitHub native protection remains effective.
aips intelligence gc 只讀取 store 內記錄的專案路徑,不輸出 topic 內容;內容安全邊界不變(Scenario 269)。
新 worktree 沒有外部 store 時,bootstrap 會以 copy-on-write 方式從同一 repository 的 READY store 複製一份;來源 store 只讀不寫,worktree_identity 變動只有在 provenance 可證明時才是觀察。複製被拒絕或失敗時退回正常初始化,並標示 intelligence_seed_fallback(Scenario 270)。