@sanqianx/project-knowledge 5.0.18 → 5.0.20-rc.1
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/.agents/plugins/marketplace.json +3 -3
- package/.claude-plugin/marketplace.json +1 -1
- package/CHANGELOG.md +14 -0
- package/LICENSE +201 -201
- package/NOTICE +5 -5
- package/README.md +349 -349
- package/_modules/knowledge-engine/README.md +4 -0
- package/_modules/knowledge-engine/src/analysis-contract.js +4 -3
- package/_modules/knowledge-engine/src/analysis-failures.js +39 -0
- package/_modules/knowledge-engine/src/analysis-worker.js +6 -2
- package/_modules/knowledge-engine/src/coordinator.js +8 -0
- package/_modules/knowledge-engine/src/headless-analyzer.js +2 -1
- package/_modules/knowledge-engine/src/memories.js +10 -5
- package/_modules/knowledge-engine/src/memory-eligibility.js +74 -0
- package/_modules/knowledge-engine/src/retrieval-ranking.js +19 -1
- package/_modules/knowledge-engine/src/runtime/commit-conversation-binder.js +1 -0
- package/_modules/knowledge-engine/src/runtime/commit-prompt.js +12 -9
- package/_modules/knowledge-engine/src/runtime/conversation-store.js +2 -0
- package/_modules/knowledge-engine/src/server.js +1 -1
- package/_site/_test/agent-capture-mcp-ui-test.js +67 -67
- package/_site/_test/ai-profile-test.js +75 -75
- package/_site/_test/ai-vendor-presets-test.js +91 -91
- package/_site/_test/automatic-context-test.js +70 -70
- package/_site/_test/bin-cli-test.js +230 -230
- package/_site/_test/bridge-adapter-test.js +95 -95
- package/_site/_test/bridge-consumer-service-test.js +310 -310
- package/_site/_test/candidate-bin-content-test.js +35 -0
- package/_site/_test/candidate-product-assets-test.js +13 -0
- package/_site/_test/candidate-release-contract-test.js +14 -14
- package/_site/_test/capture-hook-dedup-test.js +158 -158
- package/_site/_test/claude-executable-discovery-test.js +28 -28
- package/_site/_test/claude-session-lifecycle-sweep-test.js +252 -252
- package/_site/_test/cli-instance-management-test.js +62 -62
- package/_site/_test/client-capture-restart-e2e-test.js +189 -189
- package/_site/_test/codex-conversation-projection-test.js +60 -60
- package/_site/_test/codex-marketplace-scoped-path-test.js +186 -186
- package/_site/_test/codex-notify-capture-e2e-test.js +101 -101
- package/_site/_test/codex-notify-fanout-test.js +134 -134
- package/_site/_test/codex-notify-upgrade-test.js +253 -253
- package/_site/_test/commit-boundary-freeze-test.js +147 -147
- package/_site/_test/commit-conversation-binding-test.js +4 -4
- package/_site/_test/configuration-generation-test.js +22 -22
- package/_site/_test/context-pack-test.js +200 -200
- package/_site/_test/conversation-api-test.js +10 -10
- package/_site/_test/conversation-origin-test.js +15 -0
- package/_site/_test/cross-repo-isolation-e2e-test.js +187 -187
- package/_site/_test/embedding-config-test.js +32 -32
- package/_site/_test/fixtures/fake-browser-exit.js +10 -10
- package/_site/_test/fixtures/fake-browser-hang.js +10 -10
- package/_site/_test/fixtures/integration-busy-worker.cjs +6 -6
- package/_site/_test/fixtures/make-git-repos.js +92 -92
- package/_site/_test/fixtures/retrieval-gold-queries.json +32 -0
- package/_site/_test/fresh-hook-reimport-test.js +53 -53
- package/_site/_test/fresh-product-data-test.js +56 -56
- package/_site/_test/git-path-compatibility-test.js +80 -80
- package/_site/_test/git-validation-test.js +81 -81
- package/_site/_test/hook-worktree-test.js +42 -42
- package/_site/_test/index-builder-test.js +41 -41
- package/_site/_test/index-error-display-contract-test.js +10 -10
- package/_site/_test/integration-adapters-test.js +67 -67
- package/_site/_test/integration-capture-setup-test.js +118 -118
- package/_site/_test/integration-runtime-binding-a2-test.js +566 -566
- package/_site/_test/integration-runtime-binding-a3-test.js +227 -227
- package/_site/_test/integration-runtime-binding-test.js +473 -473
- package/_site/_test/integration-status-scan-test.js +29 -29
- package/_site/_test/kb-framework-test.js +57 -57
- package/_site/_test/kbpath-follow-test.js +63 -63
- package/_site/_test/knowledge-db-test.js +144 -144
- package/_site/_test/knowledge-engine-client-test.js +109 -109
- package/_site/_test/knowledge-maintenance-test.js +40 -40
- package/_site/_test/knowledge-panel-ui-contract-test.js +112 -0
- package/_site/_test/knowledge-scopes-test.js +37 -37
- package/_site/_test/knowledge-storage-location-test.js +28 -28
- package/_site/_test/launcher-readiness-test.js +80 -80
- package/_site/_test/legacy-claude-session-alias-test.js +106 -106
- package/_site/_test/legacy-routes-removed-test.js +47 -47
- package/_site/_test/legacy-workbench-exclusion-test.js +92 -92
- package/_site/_test/live-gateway-test.js +48 -48
- package/_site/_test/local-marketplace-test.js +16 -16
- package/_site/_test/log-redaction-test.js +58 -58
- package/_site/_test/markdown-maintenance-test.js +11 -11
- package/_site/_test/model-context-windows-test.js +89 -89
- package/_site/_test/module-agent-start-proxy-test.js +65 -65
- package/_site/_test/module-artifact-integrity-test.js +27 -27
- package/_site/_test/module-boundary-test.js +30 -30
- package/_site/_test/module-bridge-eventbridge-test.js +202 -202
- package/_site/_test/module-dynamic-port-test.js +118 -118
- package/_site/_test/module-index-proxy-test.js +33 -0
- package/_site/_test/module-model-configuration-test.js +44 -44
- package/_site/_test/module-process-lifecycle-test.js +35 -35
- package/_site/_test/module-stream-proxy-test.js +34 -34
- package/_site/_test/module-terminal-restart-test.js +63 -0
- package/_site/_test/module-wiring-unbind-race-test.js +59 -59
- package/_site/_test/native-context-integrations-test.js +86 -86
- package/_site/_test/orphaned-claim-recovery-test.js +80 -80
- package/_site/_test/package-boundary-test.js +43 -42
- package/_site/_test/package-startup-test.js +56 -56
- package/_site/_test/packaged-ui-smoke-test.js +88 -88
- package/_site/_test/pr-consumer-contract-test.js +55 -55
- package/_site/_test/product-brand-contract-test.js +25 -25
- package/_site/_test/product-diagnostics-ui-test.js +93 -93
- package/_site/_test/product-import-ui-test.js +104 -104
- package/_site/_test/product-progress-status-test.js +12 -1
- package/_site/_test/project-remove-running-guard-test.js +79 -79
- package/_site/_test/project-store-test.js +90 -90
- package/_site/_test/registry-events-test.js +38 -0
- package/_site/_test/release-version-sync-test.js +115 -115
- package/_site/_test/requirement-binding-test.js +113 -113
- package/_site/_test/runtime-endpoint-test.js +64 -64
- package/_site/_test/scanner-test.js +83 -83
- package/_site/_test/server-security-test.js +96 -96
- package/_site/_test/sessions-stream-test.js +93 -93
- package/_site/_test/shared-scope-root-binding-test.js +67 -67
- package/_site/_test/simple-import-test.js +98 -98
- package/_site/_test/startup-analysis-disabled-test.js +6 -6
- package/_site/_test/team-knowledge-store-sparse-checkout-test.js +196 -196
- package/_site/_test/team-knowledge-store-test.js +132 -132
- package/_site/_test/test-server-cleanup-test.js +35 -35
- package/_site/_test/test-server-module-isolation-test.js +37 -37
- package/_site/_test/tracking-start-test.js +35 -35
- package/_site/_test/workbench-context-receipts-test.js +22 -0
- package/_site/_test/workspace-ui-contract-test.js +31 -31
- package/_site/_test/zcode-capture-integration-test.js +108 -108
- package/_site/lib/ai-vendor-presets.js +83 -83
- package/_site/lib/ai-workspace.js +3 -3
- package/_site/lib/atomic-file.js +204 -204
- package/_site/lib/bridge-adapter.js +260 -260
- package/_site/lib/capture-hook-config.js +108 -108
- package/_site/lib/claude-cli-runner.js +89 -89
- package/_site/lib/cli-instances.js +43 -43
- package/_site/lib/codex-context-status.js +17 -17
- package/_site/lib/codex-notify-config.js +193 -193
- package/_site/lib/commit-conversation-binder.js +13 -12
- package/_site/lib/commit-reconciler.js +38 -38
- package/_site/lib/context-pack-builder.js +299 -299
- package/_site/lib/conversation-exclusions.js +204 -204
- package/_site/lib/conversation-query-service.js +17 -17
- package/_site/lib/conversation-store.js +2 -0
- package/_site/lib/data-dir.js +13 -13
- package/_site/lib/embedding-service.js +85 -85
- package/_site/lib/engine-connection.js +93 -90
- package/_site/lib/engine-knowledge-client.js +72 -72
- package/_site/lib/folder-picker-output.js +3 -3
- package/_site/lib/git-path.js +14 -14
- package/_site/lib/github-team-store.js +3 -3
- package/_site/lib/index-builder.js +157 -157
- package/_site/lib/integration-status-scan.js +99 -99
- package/_site/lib/integration-status-worker.js +14 -14
- package/_site/lib/kb-framework.js +15 -15
- package/_site/lib/knowledge-db.js +363 -363
- package/_site/lib/knowledge-schema.js +121 -121
- package/_site/lib/live-gateway.js +78 -76
- package/_site/lib/llm-client.js +12 -12
- package/_site/lib/model-context-windows.js +82 -82
- package/_site/lib/module-bridge.js +874 -865
- package/_site/lib/module-port-resolver.js +57 -57
- package/_site/lib/post-commit-automation.js +54 -54
- package/_site/lib/product-data.js +35 -35
- package/_site/lib/project-lifecycle-service.js +14 -14
- package/_site/lib/project-registry-store.js +129 -129
- package/_site/lib/prompt-registry.js +148 -148
- package/_site/lib/registry-events.js +16 -0
- package/_site/lib/requirement-adapters.js +10 -10
- package/_site/lib/requirement-binder.js +112 -112
- package/_site/lib/runtime-control.js +89 -89
- package/_site/lib/runtime-endpoint.js +5 -5
- package/_site/lib/server-app.js +10 -1
- package/_site/lib/zcode-context-integration.js +60 -60
- package/_site/scripts/codex-notify-fanout.cjs +95 -95
- package/_site/scripts/install-module-candidates.js +69 -69
- package/_site/scripts/pack-module-candidates.js +89 -72
- package/_site/scripts/sync-product-content.js +28 -28
- package/_site/scripts/sync-release-version.js +164 -164
- package/_site/scripts/vendor-modules.js +49 -49
- package/_site/scripts/verify-module-runtime.js +50 -50
- package/_site/scripts/verify-product-runtime.js +36 -36
- package/_site/scripts/verify-retrieval-gold.js +83 -0
- package/_site/server.js +15 -15
- package/_site/start.bat +26 -26
- package/_site/stop.bat +11 -11
- package/bin/project-knowledge-integrations.js +254 -254
- package/bin/project-knowledge-kb.js +67 -67
- package/bin/project-knowledge-mcp.js +8 -8
- package/bin/project-knowledge.js +170 -170
- package/claude-prompts.json +21 -21
- package/docs/README.zh-CN.md +205 -205
- package/docs/assets/architecture.svg +181 -181
- package/docs/assets/logo.svg +49 -49
- package/docs/fresh-v5-start.md +42 -42
- package/docs/leader-glm-workbench-playbook.md +122 -119
- package/docs/project-registry-schema.md +11 -11
- package/docs/release-5.0.16-acceptance.md +176 -176
- package/docs/release-5.0.17-acceptance.md +117 -117
- package/docs/release-5.0.19-acceptance.md +39 -0
- package/docs/team-knowledge-mode-a-plan.md +73 -73
- package/module-runtime-manifest.json +126 -104
- package/package.json +110 -108
- package/plugins/project-knowledge/.claude-plugin/plugin.json +1 -1
- package/plugins/project-knowledge/.codex-plugin/plugin.json +1 -1
- package/plugins/project-knowledge/.mcp.json +1 -1
- package/plugins/project-knowledge/opencode/project-knowledge.md +3 -3
- package/plugins/project-knowledge/skills/project-knowledge/SKILL.md +28 -28
- package/templates/change.md +30 -30
- package/templates/project-readme.md +18 -18
- package/ui/index.html +1 -1
- package/ui/knowledge-panel.html +118 -0
- package/ui/product.css +8 -0
- package/ui/product.js +175 -8
- package/vendor-manifest.json +55 -53
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: project-knowledge
|
|
3
|
-
description: Query durable Project Knowledge records for prior decisions, implementation history, known constraints, and related-project context. Use when starting non-trivial work in a registered repository, investigating why code was designed a certain way, checking whether a problem was solved before, or answering questions about earlier commits and project history.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Project Knowledge
|
|
7
|
-
|
|
8
|
-
Use Project Knowledge as a read-only source of durable project context. Automatic client capture is the primary conversation truth. Its one write-capable tool only supplements that truth with an explicit user Prompt event and never starts knowledge analysis. Verify returned knowledge against the current source whenever the repository may have changed since the knowledge entry was produced.
|
|
9
|
-
|
|
10
|
-
## Workflow
|
|
11
|
-
|
|
12
|
-
1. Call `project_knowledge_resolve` with the current Git root before substantial implementation, diagnosis, or design work. Do not guess the project slug.
|
|
13
|
-
2. Call `project_knowledge_search` for focused matching records, or `project_knowledge_ask` when a compact cited synthesis is more useful.
|
|
14
|
-
3. Review titles and summaries before loading complete entries.
|
|
15
|
-
4. Call `project_knowledge_get` only for the most relevant entries. Call `project_knowledge_history` when sequence or recent change history matters.
|
|
16
|
-
5. Cite the returned project, entry, and commit information when it materially supports an answer or decision.
|
|
17
|
-
6. Call `project_knowledge_record_requirement` only when the user explicitly requests supplemental capture or automatic client capture is known to be unavailable. Supply the exact user request, resolved project, client, and stable session identifier; never record assistant output, system prompts, credentials, or tool transcripts.
|
|
18
|
-
|
|
19
|
-
Client integrations may prefix MCP tool names with the server name. Match the tools by their final names: `project_knowledge_resolve`, `project_knowledge_record_requirement`, `project_knowledge_search`, `project_knowledge_ask`, `project_knowledge_get`, and `project_knowledge_history`.
|
|
20
|
-
|
|
21
|
-
## Boundaries
|
|
22
|
-
|
|
23
|
-
- Treat knowledge search/get/history results as read-only. The explicit adapter may only append a user Prompt event to ConversationStore.
|
|
24
|
-
- Do not write directly to the knowledge database or knowledge files.
|
|
25
|
-
- Recording a requirement must not be used as a signal that analysis already ran or succeeded.
|
|
26
|
-
- Do not substitute remembered conversation context for a knowledge lookup when prior project work is relevant.
|
|
27
|
-
- Do not treat old knowledge as stronger evidence than current code, tests, or explicit user direction.
|
|
28
|
-
- If the repository is not registered, continue using the source tree and tell the user that no matching Project Knowledge project was found.
|
|
1
|
+
---
|
|
2
|
+
name: project-knowledge
|
|
3
|
+
description: Query durable Project Knowledge records for prior decisions, implementation history, known constraints, and related-project context. Use when starting non-trivial work in a registered repository, investigating why code was designed a certain way, checking whether a problem was solved before, or answering questions about earlier commits and project history.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Project Knowledge
|
|
7
|
+
|
|
8
|
+
Use Project Knowledge as a read-only source of durable project context. Automatic client capture is the primary conversation truth. Its one write-capable tool only supplements that truth with an explicit user Prompt event and never starts knowledge analysis. Verify returned knowledge against the current source whenever the repository may have changed since the knowledge entry was produced.
|
|
9
|
+
|
|
10
|
+
## Workflow
|
|
11
|
+
|
|
12
|
+
1. Call `project_knowledge_resolve` with the current Git root before substantial implementation, diagnosis, or design work. Do not guess the project slug.
|
|
13
|
+
2. Call `project_knowledge_search` for focused matching records, or `project_knowledge_ask` when a compact cited synthesis is more useful.
|
|
14
|
+
3. Review titles and summaries before loading complete entries.
|
|
15
|
+
4. Call `project_knowledge_get` only for the most relevant entries. Call `project_knowledge_history` when sequence or recent change history matters.
|
|
16
|
+
5. Cite the returned project, entry, and commit information when it materially supports an answer or decision.
|
|
17
|
+
6. Call `project_knowledge_record_requirement` only when the user explicitly requests supplemental capture or automatic client capture is known to be unavailable. Supply the exact user request, resolved project, client, and stable session identifier; never record assistant output, system prompts, credentials, or tool transcripts.
|
|
18
|
+
|
|
19
|
+
Client integrations may prefix MCP tool names with the server name. Match the tools by their final names: `project_knowledge_resolve`, `project_knowledge_record_requirement`, `project_knowledge_search`, `project_knowledge_ask`, `project_knowledge_get`, and `project_knowledge_history`.
|
|
20
|
+
|
|
21
|
+
## Boundaries
|
|
22
|
+
|
|
23
|
+
- Treat knowledge search/get/history results as read-only. The explicit adapter may only append a user Prompt event to ConversationStore.
|
|
24
|
+
- Do not write directly to the knowledge database or knowledge files.
|
|
25
|
+
- Recording a requirement must not be used as a signal that analysis already ran or succeeded.
|
|
26
|
+
- Do not substitute remembered conversation context for a knowledge lookup when prior project work is relevant.
|
|
27
|
+
- Do not treat old knowledge as stronger evidence than current code, tests, or explicit user direction.
|
|
28
|
+
- If the repository is not registered, continue using the source tree and tell the user that no matching Project Knowledge project was found.
|
package/templates/change.md
CHANGED
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
---
|
|
2
|
-
schema: minimal-kb/v1
|
|
3
|
-
title: __SHORTCOMMIT__ __SUBJECT__
|
|
4
|
-
change: __SHORTCOMMIT__
|
|
5
|
-
commit: __COMMIT__
|
|
6
|
-
classification: __CLASSIFICATION__
|
|
7
|
-
tags: [__CLASSIFICATION__]
|
|
8
|
-
affectedModules: []
|
|
9
|
-
developmentIntent: __DEVELOPMENT_INTENT__
|
|
10
|
-
updatedAt: __DATE__
|
|
11
|
-
---
|
|
12
|
-
|
|
13
|
-
# __SHORTCOMMIT__ __SUBJECT__
|
|
14
|
-
|
|
15
|
-
## Development Intent
|
|
16
|
-
|
|
17
|
-
__DEVELOPMENT_INTENT__
|
|
18
|
-
|
|
19
|
-
## Implementation Result
|
|
20
|
-
|
|
21
|
-
- Classification: __CLASSIFICATION__
|
|
22
|
-
- Goal impact: __GOAL_IMPACT__
|
|
23
|
-
|
|
24
|
-
## Evidence
|
|
25
|
-
|
|
26
|
-
__EVIDENCE__
|
|
27
|
-
|
|
28
|
-
## Proposed Knowledge Updates
|
|
29
|
-
|
|
30
|
-
__PROPOSED_OPERATIONS__
|
|
1
|
+
---
|
|
2
|
+
schema: minimal-kb/v1
|
|
3
|
+
title: __SHORTCOMMIT__ __SUBJECT__
|
|
4
|
+
change: __SHORTCOMMIT__
|
|
5
|
+
commit: __COMMIT__
|
|
6
|
+
classification: __CLASSIFICATION__
|
|
7
|
+
tags: [__CLASSIFICATION__]
|
|
8
|
+
affectedModules: []
|
|
9
|
+
developmentIntent: __DEVELOPMENT_INTENT__
|
|
10
|
+
updatedAt: __DATE__
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# __SHORTCOMMIT__ __SUBJECT__
|
|
14
|
+
|
|
15
|
+
## Development Intent
|
|
16
|
+
|
|
17
|
+
__DEVELOPMENT_INTENT__
|
|
18
|
+
|
|
19
|
+
## Implementation Result
|
|
20
|
+
|
|
21
|
+
- Classification: __CLASSIFICATION__
|
|
22
|
+
- Goal impact: __GOAL_IMPACT__
|
|
23
|
+
|
|
24
|
+
## Evidence
|
|
25
|
+
|
|
26
|
+
__EVIDENCE__
|
|
27
|
+
|
|
28
|
+
## Proposed Knowledge Updates
|
|
29
|
+
|
|
30
|
+
__PROPOSED_OPERATIONS__
|
|
@@ -9,31 +9,31 @@ This knowledge base stores only useful, reviewed project memory. It is not a dum
|
|
|
9
9
|
|
|
10
10
|
| Path | Purpose | Policy |
|
|
11
11
|
|---|---|---|
|
|
12
|
-
| `README.md` | Knowledge-base purpose and reading guidance | Updated only through verified promotion |
|
|
13
|
-
| `GOAL.md` | Stable project goal, boundaries, and non-goals | Updated conservatively from committed evidence |
|
|
14
|
-
| `ARCHITECTURE.md` | Current architecture and key decisions | Updated conservatively from committed evidence |
|
|
15
|
-
| `modules/<module>.md` | Durable module facts tied to source paths, routes, symbols, and tests | Verified promotion only |
|
|
16
|
-
| `changes/<change>.md` | Accepted change memory with intent, result, and evidence | Verified promotion only |
|
|
12
|
+
| `README.md` | Knowledge-base purpose and reading guidance | Updated only through verified promotion |
|
|
13
|
+
| `GOAL.md` | Stable project goal, boundaries, and non-goals | Updated conservatively from committed evidence |
|
|
14
|
+
| `ARCHITECTURE.md` | Current architecture and key decisions | Updated conservatively from committed evidence |
|
|
15
|
+
| `modules/<module>.md` | Durable module facts tied to source paths, routes, symbols, and tests | Verified promotion only |
|
|
16
|
+
| `changes/<change>.md` | Accepted change memory with intent, result, and evidence | Verified promotion only |
|
|
17
17
|
|
|
18
18
|
AI run records, per-commit automation state, backups, and context packs live outside the knowledge base.
|
|
19
19
|
|
|
20
20
|
## Design Principles
|
|
21
21
|
|
|
22
22
|
1. Keep the official KB small: store stable intent, architecture, module facts, and accepted change summaries.
|
|
23
|
-
2. Search first: use the read-only knowledge tools before opening detail files.
|
|
24
|
-
3. Read only relevant memory: choose module and change files by source paths, routes, symbols, and affected modules.
|
|
23
|
+
2. Search first: use the read-only knowledge tools before opening detail files.
|
|
24
|
+
3. Read only relevant memory: choose module and change files by source paths, routes, symbols, and affected modules.
|
|
25
25
|
4. Store development intent, not raw prompts: summarize the user's request in `changes/<change>.md` under `## Development Intent`.
|
|
26
26
|
5. Update `GOAL.md` and `ARCHITECTURE.md` only when committed evidence clearly changes their current facts.
|
|
27
27
|
|
|
28
|
-
## Reading Rule
|
|
28
|
+
## Reading Rule
|
|
29
29
|
|
|
30
30
|
When starting work on a feature or fix:
|
|
31
31
|
|
|
32
|
-
1. Resolve the current project and search its scoped knowledge.
|
|
33
|
-
2. Read `GOAL.md` when the task depends on product boundaries.
|
|
34
|
-
3. Open only relevant `modules/<module>.md` and `changes/<change>.md` files.
|
|
35
|
-
4. Verify retrieved facts against current source code.
|
|
36
|
-
5. Let post-commit reconciliation update knowledge from committed evidence; do not write the final KB directly.
|
|
32
|
+
1. Resolve the current project and search its scoped knowledge.
|
|
33
|
+
2. Read `GOAL.md` when the task depends on product boundaries.
|
|
34
|
+
3. Open only relevant `modules/<module>.md` and `changes/<change>.md` files.
|
|
35
|
+
4. Verify retrieved facts against current source code.
|
|
36
|
+
5. Let post-commit reconciliation update knowledge from committed evidence; do not write the final KB directly.
|
|
37
37
|
|
|
38
38
|
## Change File Example
|
|
39
39
|
|
|
@@ -42,11 +42,11 @@ When starting work on a feature or fix:
|
|
|
42
42
|
Add a branch-aware knowledge update flow so AI records the user's feature intent without storing raw prompts.
|
|
43
43
|
|
|
44
44
|
## Implementation Result
|
|
45
|
-
- Added a frozen per-commit claim and exact Commit evidence.
|
|
46
|
-
- Promoted validated Markdown before advancing state.
|
|
45
|
+
- Added a frozen per-commit claim and exact Commit evidence.
|
|
46
|
+
- Promoted validated Markdown before advancing state.
|
|
47
47
|
|
|
48
48
|
## Evidence
|
|
49
|
-
- `_site/lib/commit-reconciler.js`
|
|
50
|
-
- `_site/lib/knowledge-promotion.js`
|
|
51
|
-
- `_site/lib/index-service.js`
|
|
49
|
+
- `_site/lib/commit-reconciler.js`
|
|
50
|
+
- `_site/lib/knowledge-promotion.js`
|
|
51
|
+
- `_site/lib/index-service.js`
|
|
52
52
|
```
|
package/ui/index.html
CHANGED
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
<header class="topbar"><div><small id="breadcrumb">我的智脑</small><h1 id="pageTitle">智脑首页</h1></div><div class="spacer"></div><select id="projectSelect" aria-label="当前项目" disabled><option value="">尚未导入项目</option></select><button id="themeToggle" class="icon-button" title="切换浅色或深色主题" aria-label="切换主题"><svg viewBox="0 0 24 24"><circle cx="12" cy="12" r="4"/><path d="M12 2v3M12 19v3M2 12h3M19 12h3"/></svg></button></header>
|
|
24
24
|
<div class="content">
|
|
25
25
|
<section class="view" id="view-home"><div class="welcome"><div><small>工作概览</small><h2 id="homeTitle">我的智脑</h2><p>保存项目事实,连接相关经验。你的长期偏好,只在确认后使用。</p></div><div class="actions"><button class="primary" data-go="work">开始工作</button><button data-action="import">导入项目</button></div></div><div id="homeContent"></div></section>
|
|
26
|
-
<section class="view module-view" id="view-work"><div id="workEmpty" class="empty" hidden>导入项目后,就可以在这里开始工作。<button data-action="import">导入项目</button></div><div class="work-layout" id="workLayout"><div class="frame-container"><iframe id="workFrame" title="Agent 工作台" referrerpolicy="same-origin"></iframe></div><aside class="knowledge-context"><header><h2>本次知识引用</h2><small id="contextScope">任务发送前自动检索</small></header><div id="contextContent" class="empty small-empty">发送任务后显示实际检索到的项目事实、领域经验和已确认记忆。</div></aside></div></section>
|
|
26
|
+
<section class="view module-view" id="view-work"><div id="workEmpty" class="empty" hidden>导入项目后,就可以在这里开始工作。<button data-action="import">导入项目</button></div><div class="work-layout" id="workLayout"><div class="frame-container"><iframe id="workFrame" title="Agent 工作台" referrerpolicy="same-origin"></iframe></div><aside class="knowledge-context"><header><h2>本次知识引用</h2><small id="contextScope">任务发送前自动检索</small><small id="panelNotice" class="panel-notice" hidden></small></header><div id="contextContent" class="empty small-empty">发送任务后显示实际检索到的项目事实、领域经验和已确认记忆。</div></aside></div></section>
|
|
27
27
|
<section class="view module-view" id="view-search"><div class="module-toolbar"><span>查找知识</span><div class="segmented" id="searchScope"><button data-scope="project">当前项目</button><button data-scope="domain">所属领域</button><button data-scope="brain">整个智脑</button></div></div><div id="searchEmpty" class="empty" hidden>尚未导入项目。<button data-action="import">导入项目</button></div><div class="frame-container"><iframe id="vectorFrame" title="知识检索" referrerpolicy="same-origin"></iframe></div></section>
|
|
28
28
|
<section class="view" id="view-memory"><div class="section-heading"><div><h2>长期记忆</h2><p>手动添加约定,或审核 Agent 提取的候选;确认内容与适用范围后生效。</p></div><button id="addMemory" class="primary" disabled>添加记忆</button></div><div class="memory-toolbar"><div class="segmented" id="memoryTabs"><button data-memory-tab="confirmed">已确认</button><button data-memory-tab="candidate">候选箱 <span id="candidateCount"></span></button></div><div class="actions"><select id="memoryScopeFilter" aria-label="筛选记忆范围"><option value="">全部范围</option><option value="global">全局记忆</option><option value="domain">领域记忆</option><option value="project">项目记忆</option></select><select id="memoryTargetFilter" aria-label="筛选记忆目标" hidden></select></div></div><div id="memoryContent"></div></section>
|
|
29
29
|
<section class="view" id="view-projects"><div class="section-heading"><div><h2>领域与项目</h2><p>统一管理归属,项目知识仍保存在原来的目录。</p></div><div class="actions"><button id="createDomain">创建领域</button><button class="primary" data-action="import">导入项目</button></div></div><div class="hierarchy"><div class="panel tree" id="projectTree"></div><div class="panel" id="projectDetail"></div></div></section>
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="zh-CN">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width,initial-scale=1">
|
|
6
|
+
<meta name="color-scheme" content="light dark">
|
|
7
|
+
<title>本次知识引用</title>
|
|
8
|
+
<style>
|
|
9
|
+
:root{color-scheme:light dark;font-family:system-ui,-apple-system,"Segoe UI","Microsoft YaHei",sans-serif}
|
|
10
|
+
body{margin:0;padding:16px 12px;background:#f7f7f5;color:#1f2328;font-size:13px;line-height:1.6}
|
|
11
|
+
h1{font-size:13px;margin:0 0 4px}
|
|
12
|
+
#panelStatus{margin:0 0 12px;color:#5a6069}
|
|
13
|
+
#panelProject{display:block;margin:0 0 12px;color:#5a6069;font-size:12px}
|
|
14
|
+
.reference{border:1px solid #e3e4e8;border-radius:8px;background:#fff;padding:10px 12px;margin:0 0 8px}
|
|
15
|
+
.reference h2{font-size:13px;margin:0 0 4px}
|
|
16
|
+
.reference small{display:block;color:#5a6069;overflow-wrap:anywhere}
|
|
17
|
+
.reference code{display:block;color:#5a6069;font-size:11px;margin-top:4px;overflow-wrap:anywhere}
|
|
18
|
+
.reference p{margin:6px 0 0;white-space:pre-wrap;overflow-wrap:anywhere}
|
|
19
|
+
.kb-empty{color:#5a6069}
|
|
20
|
+
#panelMarker{display:block;margin-top:16px;color:#9aa0a8;font-size:11px;letter-spacing:.04em}
|
|
21
|
+
@media (prefers-color-scheme:dark){body{background:#14161a;color:#e6e8eb}.reference{background:#1c1f24;border-color:#2c3038}#panelStatus,#panelProject,.reference small,.reference code,.kb-empty{color:#9aa0a8}}
|
|
22
|
+
</style>
|
|
23
|
+
</head>
|
|
24
|
+
<body>
|
|
25
|
+
<h1 id="panelTitle">本次知识引用</h1>
|
|
26
|
+
<small id="panelProject"></small>
|
|
27
|
+
<p id="panelStatus">等待知识内容…</p>
|
|
28
|
+
<div id="panelReferences"><p class="kb-empty">面板就绪后显示实际检索到的项目事实、领域经验和已确认记忆。</p></div>
|
|
29
|
+
<footer id="panelMarker">KB-K1-KNOWLEDGE-PANEL-v1</footer>
|
|
30
|
+
<script>
|
|
31
|
+
(function () {
|
|
32
|
+
'use strict';
|
|
33
|
+
// This page runs inside the Workbench right dock in a scripts-only sandbox
|
|
34
|
+
// (opaque origin). The ONLY inbound channel is kb:panel/content from the
|
|
35
|
+
// workbench parent window, matched by source identity - an origin string is
|
|
36
|
+
// meaningless for an opaque-origin frame. Everything renders through
|
|
37
|
+
// textContent/createElement; external strings stay inert text forever.
|
|
38
|
+
var STATUS_LABELS = {
|
|
39
|
+
ready: '已检索知识',
|
|
40
|
+
'file-fallback': '索引暂不可用,已检索原文件',
|
|
41
|
+
unavailable: '知识服务不可用,未注入上下文',
|
|
42
|
+
unregistered: '项目尚未登记知识库',
|
|
43
|
+
disabled: '未启用知识连接',
|
|
44
|
+
'not-retrieved': '任务发送前自动检索'
|
|
45
|
+
};
|
|
46
|
+
var titleNode = document.getElementById('panelTitle');
|
|
47
|
+
var projectNode = document.getElementById('panelProject');
|
|
48
|
+
var statusNode = document.getElementById('panelStatus');
|
|
49
|
+
var refsNode = document.getElementById('panelReferences');
|
|
50
|
+
|
|
51
|
+
function acknowledge(panelId, version, ok, error) {
|
|
52
|
+
try {
|
|
53
|
+
window.parent.postMessage({
|
|
54
|
+
type: 'kb:panel/content-ack',
|
|
55
|
+
panelId: String(panelId == null ? '' : panelId),
|
|
56
|
+
version: version === undefined ? null : version,
|
|
57
|
+
ok: ok === true,
|
|
58
|
+
error: error ? String(error).slice(0, 200) : null
|
|
59
|
+
}, '*');
|
|
60
|
+
} catch (failure) { /* a broken parent channel never breaks rendering */ }
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function renderReference(entry) {
|
|
64
|
+
var item = document.createElement('article');
|
|
65
|
+
item.className = 'reference';
|
|
66
|
+
var heading = document.createElement('h2');
|
|
67
|
+
heading.textContent = String(entry.title || entry.entryId || '知识引用');
|
|
68
|
+
var source = document.createElement('small');
|
|
69
|
+
source.textContent = String(entry.source || '');
|
|
70
|
+
var entryId = document.createElement('code');
|
|
71
|
+
entryId.textContent = String(entry.entryId || '');
|
|
72
|
+
var text = document.createElement('p');
|
|
73
|
+
text.textContent = String(entry.text || '').slice(0, 800);
|
|
74
|
+
item.append(heading, source, text, entryId);
|
|
75
|
+
return item;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
function render(data) {
|
|
79
|
+
var content = data.content;
|
|
80
|
+
if (content === null || typeof content !== 'object' || Array.isArray(content)) {
|
|
81
|
+
throw new Error('内容必须是普通对象');
|
|
82
|
+
}
|
|
83
|
+
titleNode.textContent = String(content.title || '本次知识引用');
|
|
84
|
+
projectNode.textContent = String(content.projectId || '');
|
|
85
|
+
statusNode.textContent = STATUS_LABELS[String(content.status || '')] || '本次任务上下文';
|
|
86
|
+
refsNode.replaceChildren();
|
|
87
|
+
var references = Array.isArray(content.references) ? content.references : [];
|
|
88
|
+
var rendered = 0;
|
|
89
|
+
for (var i = 0; i < references.length && rendered < 100; i += 1) {
|
|
90
|
+
var entry = references[i];
|
|
91
|
+
if (entry === null || typeof entry !== 'object') continue;
|
|
92
|
+
refsNode.append(renderReference(entry));
|
|
93
|
+
rendered += 1;
|
|
94
|
+
}
|
|
95
|
+
if (!rendered) {
|
|
96
|
+
var empty = document.createElement('p');
|
|
97
|
+
empty.className = 'kb-empty';
|
|
98
|
+
empty.textContent = content.status === 'ready' ? '本次任务未找到可引用的知识。' : '发送任务后显示实际检索到的项目事实、领域经验和已确认记忆。';
|
|
99
|
+
refsNode.append(empty);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
window.addEventListener('message', function (event) {
|
|
104
|
+
if (event.source !== window.parent) return;
|
|
105
|
+
var data = event.data;
|
|
106
|
+
if (data === null || typeof data !== 'object' || data.type !== 'kb:panel/content') return;
|
|
107
|
+
try {
|
|
108
|
+
render(data);
|
|
109
|
+
acknowledge(data.panelId, data.version, true, null);
|
|
110
|
+
} catch (error) {
|
|
111
|
+
statusNode.textContent = '知识内容渲染失败,已通知工作台恢复固定知识栏。';
|
|
112
|
+
acknowledge(data.panelId, data.version, false, error && error.message ? error.message : 'render failed');
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
})();
|
|
116
|
+
</script>
|
|
117
|
+
</body>
|
|
118
|
+
</html>
|
package/ui/product.css
CHANGED
|
@@ -11,3 +11,11 @@ html[data-theme=dark]{--page:#171a1f;--surface:#20252d;--surface2:#252b34;--surf
|
|
|
11
11
|
.app{height:100%;display:grid;grid-template-columns:232px minmax(0,1fr)}.sidebar{display:flex;flex-direction:column;border-right:1px solid var(--line);background:var(--nav);min-height:0}.brand{display:flex;align-items:center;gap:8px;padding:24px 20px 16px}.brand-mark{width:32px;height:32px;display:block;flex:none;object-fit:contain}.brand strong{font-size:14px}.brand small{display:block}.brain-label{padding:0 20px 16px;color:var(--muted);overflow-wrap:anywhere}.sidebar nav{display:grid;gap:8px;padding:8px 12px}.sidebar nav button{justify-content:flex-start;min-height:40px;text-align:left;border-color:transparent;background:transparent;color:var(--muted)}.sidebar nav button.active{border-color:var(--line);background:var(--surface);color:var(--text)}.count{margin-left:auto;background:var(--surface3);padding:0 6px;border-radius:4px}.system-button{margin: auto 12px 16px;justify-content:flex-start;min-height:56px;background:transparent;border-color:transparent;padding:8px}.system-button>span:nth-child(2){flex:1;text-align:left}.system-button b,.system-button small{display:block;font-size:11px}.dot{width:7px;height:7px;border-radius:50%;background:var(--faint);flex:none}.dot.up{background:var(--good)}.dot.issue{background:var(--bad)}main{min-width:0;min-height:0;display:flex;flex-direction:column}.topbar{height:72px;flex:none;display:flex;align-items:center;gap:16px;padding:0 24px;background:var(--surface);border-bottom:1px solid var(--line)}.spacer{flex:1}.topbar select{width:240px}.icon-button{padding:8px;min-width:34px}.content{position:relative;flex:1;min-height:0}.view{display:none;height:100%;overflow:auto;padding:32px}.view.active{display:block}.view.module-view{padding:0;overflow:hidden}.module-view.active{display:flex;flex-direction:column}.frame-container{position:relative;flex:1;min-width:0;min-height:0;overflow:hidden;background:var(--surface)}iframe{display:block;width:100%;height:100%;border:0;background:var(--surface)}.work-layout{display:grid;grid-template-columns:minmax(0,1fr) 288px;height:100%;min-height:0}.knowledge-context{background:var(--surface2);border-left:1px solid var(--line);overflow:auto;padding:24px 16px}.knowledge-context header{margin-bottom:24px}.knowledge-context h2{font-size:13px}.module-toolbar{flex:none;min-height:56px;display:flex;justify-content:space-between;align-items:center;gap:16px;padding:8px 24px;border-bottom:1px solid var(--line);background:var(--surface)}.segmented{display:flex;gap:4px}.segmented button{background:transparent;border-color:transparent;color:var(--muted)}.segmented button.active{background:var(--surface);border-color:var(--line);color:var(--text)}
|
|
12
12
|
.welcome{display:flex;align-items:center;justify-content:space-between;gap:24px;margin-bottom:32px}.welcome h2{font-size:24px;margin-top:8px}.actions{display:flex;gap:8px;align-items:center}.grid2{display:grid;grid-template-columns:minmax(0,1.4fr) minmax(320px,1fr);gap:24px}.stack{display:grid;gap:24px}.panel{border:1px solid var(--line);background:var(--surface);border-radius:8px;padding:24px;min-width:0}.panel h2{margin-bottom:16px}.section-heading{display:flex;align-items:center;justify-content:space-between;gap:24px;margin-bottom:24px}.section-heading p{font-size:12px}.row{display:flex;align-items:center;gap:16px;padding:16px 0;border-bottom:1px solid var(--line)}.row:last-child{border-bottom:0}.row>div{flex:1;min-width:0}.row b{font-weight:600}.row small{display:block;margin-top:4px;overflow-wrap:anywhere}.row time{color:var(--muted);font-size:11px;flex:none}.status{font-size:11px;border:1px solid var(--line);border-radius:4px;padding:2px 8px;white-space:nowrap;color:var(--muted)}.status.up{color:var(--good)}.status.issue{color:var(--bad);background:var(--bad-soft)}.empty{padding:64px 24px;text-align:center;color:var(--muted);background:var(--surface);border-radius:8px;line-height:1.9}.empty button{display:block;margin:16px auto 0}.small-empty{padding:16px 0;text-align:left;background:transparent;font-size:12px}.hierarchy{display:grid;grid-template-columns:296px minmax(0,1fr);gap:24px}.tree h3{margin:24px 0 8px;color:var(--muted);font-size:11px}.tree button{width:100%;justify-content:flex-start;text-align:left;background:transparent;border-color:transparent;margin-top:4px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.tree button.active{background:var(--accent-soft);color:var(--accent)}.detail-path{padding:12px 16px;background:var(--surface2);border:1px solid var(--line);border-radius:8px;margin:8px 0 24px;font:12px/1.8 Consolas,"Microsoft YaHei",monospace;overflow-wrap:anywhere}.detail-label{color:var(--muted);font-size:11px}.memory-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:24px;margin-top:24px}.memory-card{padding:24px;border:1px solid var(--line);border-radius:8px;background:var(--surface)}.memory-card p{color:var(--text);margin:0 0 16px;white-space:pre-wrap}.memory-card .actions{margin-top:16px}.reference{display:block;text-align:left;width:100%;background:transparent;border:0;border-bottom:1px solid var(--line);border-radius:0;padding:16px 0}.reference b,.reference small{display:block;text-align:left}.reference p{font-size:12px;text-align:left}.activity-updates{flex:1;overflow:auto;padding:24px 32px}.run{margin-bottom:16px;background:var(--surface);border:1px solid var(--line);border-radius:8px}.run summary{padding:16px 24px;cursor:pointer;display:flex;align-items:center;gap:16px}.run summary strong{flex:1}.run>div{padding:0 24px 24px}.run .error{color:var(--bad)}.operation{padding:8px 0;color:var(--muted)}
|
|
13
13
|
.drawer-backdrop{position:fixed;inset:0;background:rgba(10,18,25,.25);z-index:20}.drawer{position:fixed;right:0;top:0;height:100%;width:448px;background:var(--surface);border-left:1px solid var(--line);z-index:21;display:flex;flex-direction:column}.drawer>header{height:72px;display:flex;align-items:center;justify-content:space-between;padding:24px;border-bottom:1px solid var(--line)}.drawer-content{overflow:auto;flex:1;padding:24px}.drawer section{padding-bottom:24px;margin-bottom:24px;border-bottom:1px solid var(--line)}.drawer select{width:100%;margin:16px 0}.drawer .actions{flex-wrap:wrap}.drawer section:last-child{border-bottom:0}.input-with-action{display:flex;gap:8px;margin-top:8px}.input-with-action input{flex:1}.input-with-action button{flex:none}.checkbox{display:flex;align-items:center;gap:8px}.checkbox input{width:auto;margin:0}dialog{width:560px;max-width:90vw;max-height:90vh;overflow:auto;background:var(--surface);color:var(--text);border:1px solid var(--line);border-radius:12px;padding:24px}dialog::backdrop{background:rgba(10,18,25,.35)}.dialog-heading{display:flex;align-items:center;justify-content:space-between;margin-bottom:16px}.dialog-heading>button{border:0;background:transparent;font-size:20px}.dialog-actions{display:flex;justify-content:flex-end;gap:8px;margin-top:24px}.feedback{padding:12px 16px;background:var(--surface2);border:1px solid var(--line);border-radius:8px;color:var(--muted);white-space:pre-wrap}.feedback.issue{color:var(--bad)}.reference-dialog{width:880px}.reference-dialog pre{margin-top:24px;max-height:60vh;overflow:auto}.engine-dialog{width:calc(100vw - 96px);height:calc(100vh - 96px);padding:0;overflow:hidden}.engine-dialog .dialog-heading{height:64px;padding:16px 24px;border-bottom:1px solid var(--line);margin:0}.engine-dialog iframe{height:calc(100% - 64px)}.toast{position:fixed;bottom:24px;right:24px;z-index:50;background:var(--surface);padding:12px 16px;border:1px solid var(--line);border-radius:8px;max-width:480px;color:var(--text)}
|
|
14
|
+
/* K1 knowledge panel: when the dock panel owns the content, the fixed column
|
|
15
|
+
folds via a grid-track animation - no extra toggle button is introduced. */
|
|
16
|
+
.work-layout{transition:grid-template-columns .2s ease}
|
|
17
|
+
.work-layout.kb-panel-collapsed{grid-template-columns:minmax(0,1fr) 0px}
|
|
18
|
+
.knowledge-context{min-width:0;transition:visibility .2s ease,padding .2s ease}
|
|
19
|
+
.work-layout.kb-panel-collapsed .knowledge-context{visibility:hidden;border-left-width:0;padding-left:0;padding-right:0}
|
|
20
|
+
.panel-notice{display:block;margin-top:4px;color:var(--bad,#b3261e)}
|
|
21
|
+
@media (prefers-reduced-motion: reduce){.work-layout,.knowledge-context{transition:none}}
|