Compare commits

..
Author SHA1 Message Date
weichenandCursor 5e5bc1f03b docs(agents): require feature branches off dev for all work
Align AGENTS, Cursor rule, PROJECT, README, templates, and CURRENT with
strategy A: no direct commits on dev/test/main; all work branches from dev.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:44:39 +00:00
weichenandCursor 8ff4d338d5 docs(ops): remove .doc root stubs and archive completed research
Delete 15 redirect stubs now that canonical paths exist under audit/
and remediation/. Move completed ops/research to archive, fix internal
links, and remove untracked duplicate test-report workspace artifacts.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:36:23 +00:00
weichenandCursor f3392face9 docs(archive): relocate superpowers, workflow, and test assets
Move docs/superpowers to archive/design/superpowers with stubs;
archive workflow rules to PROJECT SSOT; separate test-report assets.
Update Go doc path references.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:31:30 +00:00
weichenandCursor 43c972d0ad docs(agents): multi-agent rules, templates, and tool entrypoints
Rewrite AGENTS.md with taxonomy, worktree, and integration slot rules;
add FEATURE-MATRIX-driven CURRENT; tool stubs; session-close checklist.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:31:27 +00:00
weichenandCursor 33b1b8be62 docs(ops): scaffold doc taxonomy and relocate audit/remediation
Establish .doc/{status,audit,remediation,archive} structure with README
maps, migrate 15 root audit/remediation docs, and add redirect stubs.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:31:24 +00:00
weichenandCursor 3596109424 docs(ops): 勾选 pi-agent provider 修复提交证据
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 01:39:07 +00:00
weichenandCursor 8f3aa0f0c1 fix(agent): 将 pi-agent 默认模型对齐为 MiniMax-M2.7-highspeed
根因是 Go 默认 provider 误为 cc-switch-kimi-for-coding,且 app 容器未注入 PI_AGENT_*,导致 runner 收到未知 provider。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 01:39:01 +00:00
weichenandCursor ac7419e0fc fix(deploy): main 环境注入生产密钥并完成本地冒烟验收
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-12 23:51:56 +00:00
weichenandCursor b4bc0c2af3 docs(audit): 以 gap-matrix 与 ops 对齐 Codex 再审计结论
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-12 16:55:51 +00:00
weichenandCursor 505c4193fd fix(ops): HTTP 超时、env status 只读;test/dev 镜像重建 schema 25
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-12 16:55:21 +00:00
weichenandCursor 91985a23c6 fix: 闭环 Go 质量门禁(鉴权富化/V0.5/vet/health/KB gate/记忆轮询)
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-12 16:54:19 +00:00
weichenandCursor 1fb7393763 chore(ops): 新增退休非正式工作流定义脚本
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-12 16:53:00 +00:00
weichenandCursor b13ced641a feat(db): 同步种子用户与项目序列避免冷启动主键冲突
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-12 16:52:30 +00:00
weichenandCursor d82021e9b2 fix(api): 任务同步与SSE入口补齐项目成员鉴权
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-12 16:52:27 +00:00
weichenandCursor 31fe607e64 docs(ops): 建立通用 AGENTS 手册与本仓 PROJECT/CLAUDE 入口
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-12 16:51:58 +00:00
weichen eb5634a06e test(governance): 补跑 product_manager PG+PI 全链路并通过
抽取 runPiAgentGovernanceE2E 共用 harness,新增 system_reqs 真实 Agent 验收并更新测试报告。
2026-09-12 16:19:14 +00:00
weichen 63a5e2849f docs(test): 更新 gap matrix MISSING-04 为 PASS 2026-09-12 15:40:24 +00:00
weichen f4cb9176e7 test(governance): PI Agent PG 全链路实测通过并固化运行条件
修复 runner 鉴权与 data/dev 工作区挂载,使用正式 main 工作流完成 intake→批准→推进。
2026-09-12 15:40:13 +00:00
weichen 51ac51235e feat(projectcontext): bizdev 注入项目对话并完成 PG 治理 E2E
新增 ctxmgr 项目对话采集并接入 PM/TE BuildSnapshot;PG 测试统一 TEST_DATABASE_URL 并使用三正式工作流 key。
2026-09-12 15:16:02 +00:00
weichenandClaude Sonnet 5 203f1c8a82 docs(audit): comprehensive project code review and remediation plan
Complete audit and remediation documentation for Chat-Agent-System:

- 2026-09-12-AUDIT-INDEX.md: Document index and quick navigation guide
- 2026-09-12-audit-summary-report.md: Overall project assessment (5.7/10)
  - 12 identified defects (3 critical, 4 high, 5 medium)
  - 3 incomplete features
  - Risk assessment and remediation timeline (61h total)

- 2026-09-12-comprehensive-audit-and-remediation-plan.md: Detailed analysis
  - BUG-01 to BUG-12: Root cause, code locations, impact
  - MISSING-01 to MISSING-04: New feature design
  - Phase A/B/C remediation strategy

- 2026-09-12-remediation-tasks-and-acceptance-checklist.md: Executable tasks
  - 15 detailed tasks with code snippets and test cases
  - 61 hours total effort (Phase A:15h, B:26h, C:20h)

- 2026-09-12-quick-reference-guide.md: Fast lookup and diagnostics
  - Symptom → root cause → solution matrix
  - Code hotspot map and common Q&A

Key findings:
- Project 70% complete, needs immediate remediation
- 3 critical bugs affecting project lifecycle, security, data consistency
- 0% E2E test coverage
- 88 test definitions polluting development database

Recommendation: Start Phase A immediately (critical fixes), complete all remediation within one week.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-12 15:12:30 +00:00
weichen bb138475e3 fix(governance): 统一文档访问判定与上下文快照排除计数
补齐 DocumentAccessDecider HTTP 409、projectcontext 私有对话排除统计,并更新整改 gap matrix 与测试报告。
2026-09-12 15:10:23 +00:00
weichenandCursor e197e3f69a fix(frontend): skip hash anchor navigation until session is validated
Avoid chat day fetches with empty session_id on the login page when a stale URL hash is present.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-12 14:39:01 +00:00
weichenandCursor 94ee09c9f2 docs(workflow): record three-workflow governance remediation and test report
Archive the strict governance design notes and validation report for the 2026-09-12 remediation cycle.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-12 14:33:49 +00:00
weichenandCursor edd3a57b8a test(workflow): add governance regression and activation PG coverage
Cover public auth config, catalog policy, official main workflow activation on Postgres, and conn-busy metadata writeback fixes.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-12 14:33:47 +00:00
weichenandCursor 7ecb121314 fix(frontend): gate data fetches until session validated and improve workflow UX
Prevent login-page 401 noise by deferring project/chat API calls until auth is confirmed, use public-config for registration policy, and add client-side duty assignment checks before saving workflow plans.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-12 14:33:45 +00:00
weichenandCursor 812fa6ecdf feat(api): add workflow catalog routes and public auth config endpoint
Expose governance APIs for workflow selection/termination and allow login pages to read registration policy without admin credentials.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-12 14:33:43 +00:00
weichenandCursor 9ef217cb4b feat(service): enforce three-workflow governance and instance lifecycle
Wire catalog policy, v2 manifests, stage access, activation metadata fixes, and coordinator instance advance around frozen workflow snapshots.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-12 14:33:41 +00:00
weichenandCursor 8862fc31f9 feat(db): add workflow schema v2 and catalog governance migrations
Introduce catalog governance tables and extend workflow schema v2 so only the three official workflows are selectable at runtime.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-12 14:33:38 +00:00
weichenandCursor 899a0e65e6 feat(authz): implement six-phase permissions, settings and workflow v2
CI / go-vet-and-short-test (push) Failing after 0s
CI / backup-restore-drill (push) Failing after 0s
CI / web (push) Failing after 32s
Close P0 auth gaps for lineage/runs, stage ABAC fail-closed, and
project:create; add IAM migrations 00021-23, me settings APIs, schema v2
manifests, orchestrator skeleton, and gate A regression coverage.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-12 12:06:53 +00:00
weichenandCursor bb3f3a1b93 docs(test): record pi-agent E2E v5 PASS after env sync fix
Full lifecycle passed in 714s with MiniMax token, RUNNER_AUTH_TOKEN, and shared KB connected.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-12 11:51:07 +00:00
weichenandCursor 182d9d7757 docs(config): align .env.example with dual-env compose layout
Document CONTEXT_DB/SYSTEM_DB aliases, pi-agent secrets sync to configs/.env.dev, and compose vs host Go variable scope.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-12 11:36:10 +00:00
weichenandCursor 5c0235e269 docs(test): record pi-agent E2E v3 failure at 60m step timeout
V0.1 step_01_organize exceeded AgentTimeout after KB and timeout passthrough fixes.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-12 11:28:05 +00:00
weichenandCursor 47c5b52c21 fix(squad): propagate AgentTimeout to pi-agent step execution
E2E v2 still hit 30min runner timeout because runOneStep ignored ExecuteOptions.Timeout; inject shared KB config in pi-agent E2E test.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-12 10:24:45 +00:00
weichenandCursor be07346275 fix(test): extend pi-agent E2E AgentTimeout to 60m for stage runs.
CI / go-vet-and-short-test (push) Failing after 2s
CI / backup-restore-drill (push) Failing after 0s
CI / web (push) Failing after 44s
V0.1 workflow steps exceeded the default 30m pi-agent /v1/run deadline; align test config with production AGENT_TIMEOUT and runner env vars.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-12 09:50:37 +00:00
weichenandCursor fca1ddc297 docs(test): record pi-agent E2E failure at V0.1 stage timeout.
CI / go-vet-and-short-test (push) Failing after 0s
CI / backup-restore-drill (push) Failing after 0s
CI / web (push) Failing after 36s
Document 33min run with dialogue steps passing and workflow ExecuteStage failing on pi-agent /v1/run deadline.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-12 09:47:50 +00:00
weichenandCursor 9ad4f2b622 chore(ops): add test env smoke script and document test soak pass.
CI / go-vet-and-short-test (push) Failing after 0s
CI / backup-restore-drill (push) Failing after 0s
CI / web (push) Failing after 30s
Provide git-push-dev helper, DEP-001 smoke checks for test compose, and update E2E/soak test report.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-12 09:42:45 +00:00
weichenandCursor e829dd6074 fix(db): enable test env cold-start migrations on empty database.
Use pgvector image with extensions-only init, seed legacy users before project/chat fixtures, and align test compose with goose-only schema bootstrap.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-12 09:42:45 +00:00
weichenandCursor 12122d06b5 docs(test): update report with successful push and dev soak.
CI / go-vet-and-short-test (push) Failing after 0s
CI / backup-restore-drill (push) Failing after 1s
CI / web (push) Failing after 34s
Record Gitea token push, restarted dev server ready checks, and 60s soak pass.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-12 09:25:21 +00:00
weichenandCursor cf9ad06b13 docs(test): report PG fix, CI short suite, and soak/E2E progress.
CI / go-vet-and-short-test (push) Failing after 0s
CI / backup-restore-drill (push) Failing after 0s
CI / web (push) Failing after 1m20s
Document seed user reactivation, full short test pass, readiness soak, and blocked git push pending credentials.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-12 09:14:07 +00:00
weichenandCursor e47dae04f0 fix(test): stabilize PG seed users and CI short test suite.
Reactivate dev seed users after auth PG tests, use unique session tokens, fix import guard and coordinator assertions, and skip flaky E2E in short mode; add pg_restore CI drill job.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-12 09:14:02 +00:00
weichenandCursor 48ab158672 docs(test): archive QA-001 backup drill and penetration test report.
CI / go-vet-and-short-test (push) Failing after 19m20s
CI / web (push) Failing after 3m25s
Record template MIME, CI gate, backup/RPO drill, and security negative case results per test report standard.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-12 08:59:19 +00:00
weichenandCursor a4df9b966d test(security): add automated penetration negative test matrix.
Cover anonymous admin/task access, body limits, MIME rejection, strict readiness, and CORS allowlist without legacy test principals.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-12 08:59:19 +00:00
weichenandCursor 07ce332a31 chore(ops): add system DB backup and restore drill scripts.
Support dev/test/main pg_dump backups with RPO manifest metadata and a restore drill that validates dump integrity and migration idempotency.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-12 08:59:19 +00:00
weichenandCursor 546de528aa ci: add QA-001 gate with go vet, short tests, and migration check.
Run migration gate against CI Postgres and add web npm test/build jobs on dev/test/main pushes and PRs.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-12 08:59:19 +00:00
weichenandCursor 3fcb096fc6 feat(upload): reuse MIME validator for workflow template uploads.
Centralize template extension, magic-byte, and HTML/script rejection in upload.ValidateTemplate so admin template POST matches project asset hardening.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-12 08:59:17 +00:00
weichenandCursor d85f80204a feat(ops): compose runner auth, upload MIME validation, and test soak
Wire RUNNER_AUTH_TOKEN through dev/test/main Compose, validate uploads
with extension whitelist and content sniffing, add readiness soak script
and short PG loop test, and require runner token in prod when URL is set.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-12 08:51:10 +00:00
weichenandCursor e416b67a45 feat(taskrun): resume interrupted runs and harden P1 security gaps
Add confirm-gated resume API with resumable flag, Phase 5 finalize fault
and rolling-restart replay tests, Mermaid strict mode, request body limits,
and optional Runner Bearer auth between app and pi-agent.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-12 08:49:23 +00:00
weichenandCursor b3e529e444 feat(taskrun): add worker lease/heartbeat and Phase 5 fault injection tests
Introduce goose v20 lease columns with heartbeat loops so only expired
leases are marked interrupted on restart; add PG tests for concurrent
stage advance, active lease survival, and backup migration idempotency.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-12 08:46:05 +00:00
weichenandCursor b7cd24b267 feat(taskrun): persist runs/events and fix finalize-before-done ordering
Add goose v19 task_runs/task_run_events tables with PG store for restart
replay, orphan interruption on startup, strict /ready checks, and strip
client work_dir from chat/SSE paths per P0 path sandbox requirements.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-12 06:07:31 +00:00
weichenandCursor f24a759d1e fix(projectworkflow): generate UTF-8 safe project codes for Chinese names
Truncate project codes by rune instead of byte to prevent invalid PostgreSQL UTF-8 sequences from mixed CJK and ASCII slugs.

test(server): add PG pi-agent governance E2E and Phase 5 acceptance matrix

Cover Chinese HTTP project create, pi-agent intake after workflow activate, authz negatives, activate idempotency, and migration version gate.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-12 05:58:04 +00:00
weichenandCursor 76426d0420 docs(test): fix report structure for blended ABAC and PG chain cases
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-12 05:52:05 +00:00
weichenandCursor d123f41738 feat(abac): filter blended squad context and add PG governance E2E
Route BuildBlendedSquadContext through stage access gate, and add PG integration test covering activate, doc approval hook, notifications, ABAC, and stage advance.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-12 05:51:58 +00:00
weichenandCursor b78f1faa56 docs(test): add pi-agent E2E and bizdev ABAC acceptance report
Record real pi-agent lifecycle run (676s PASS) and stage access gate unit test results per delivery checklist.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-12 05:46:19 +00:00
weichenandCursor 686d39ec62 fix(e2e): authenticate multi-role docgov steps in pi-agent lifecycle test
Align seeded user IDs and use per-role Bearer tokens so review reject/approve actions run as the assigned reviewer instead of the legacy fallback principal.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-12 05:34:50 +00:00
weichenandCursor dff1d60c48 feat(abac): gate bizdev agent context by workflow stage duties
Inject stage access gate into bizdev service so task execution, project context reads, and prior docs respect live workflow ABAC.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-12 05:27:25 +00:00
weichenandCursor 3f0bb28072 test(e2e): extend pi-agent lifecycle timeout to 1h
Allow long-running ad-hoc pi-agent steps by raising the HTTP client limit and documenting the 1h go test invocation.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-12 05:27:25 +00:00
weichenandCursor b48e0082c2 feat(notification): add 24h stage advance reminder and confirm on advance.
Poll pending requests every 15 minutes, emit deduplicated escalation notifications, and close requests when creator confirms stage advance.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-12 03:26:30 +00:00
weichenandCursor 23872ab704 feat(abac): enforce stage access on chat, search and SSE streams.
Tag messages with stage_key metadata, block sends for unauthorized roles, and filter history/search/case results by allowed stages.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-12 03:20:31 +00:00
weichenandCursor a484c808d3 feat(web): poll stage ready notifications to refresh advance banner.
Poll project notifications every 15s and reload readiness when stage_ready_to_advance arrives.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-12 03:14:30 +00:00
weichenandCursor b41bfade53 feat(api): wire document approval hook and project notifications API.
Register workflow approval callback on server start and expose GET /projects/{id}/notifications.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-12 03:14:30 +00:00
weichenandCursor 8b7c4dfcc6 feat(projectinstance): refresh stage readiness after document approval.
Sync doc task status on approve and evaluate whether to emit stage advance readiness; chain docgov hooks.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-12 03:14:30 +00:00
weichenandCursor 6fb28aabb7 feat(notification): emit deduplicated stage ready to advance events.
Write outbox row and creator notification when a stage first becomes advance-ready.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-12 03:14:30 +00:00
weichenandCursor 00b0bb6882 feat(db): add outbox, notifications and stage advance request tables.
Support transactional stage.ready_to_advance events with dedupe by stage instance and config revision.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-12 03:14:30 +00:00
weichenandCursor 5ec4951f9b feat(abac): restrict workflow document access by active stage duties.
Resolve stage access from live instance assignments and filter document list/content for non-assigned roles.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-12 03:10:47 +00:00
weichenandCursor 0a8baab272 test(db): add PG integration test for activation and stage advance.
Verify migration 00017 and full plan→preview→activate→advance chain against dev Postgres.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-12 03:10:45 +00:00
weichenandCursor 25f2917a46 feat(service): add stage gate readiness and creator-confirmed advance.
Evaluate required document approvals before stage transition, expose readiness/advance APIs, show StageAdvanceBanner in the UI, and keep legacy workflow switch for explicit initial_workflow_key projects.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-12 03:06:55 +00:00
weichenandCursor 8c2c8d4c4f docs(test): add Phase 3 project workflow governance test report.
Document planning-mode creation, plan/preview/activate unit results, and API regression outcomes for the instance governance MVP.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-12 03:03:34 +00:00
weichenandCursor 3fca0f1aca feat(web): add project workflow settings wizard and replace free switcher.
Topbar shows configure/view workflow actions under governance mode with a multi-step ProjectSettingsModal for plan, duty assignment, and confirmed activation.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-12 03:03:34 +00:00
weichenandCursor 8ef408ba58 feat(api): expose project settings endpoints and block legacy workflow switching.
Add settings/plan/preview/activate routes and reject active-workflow toggles when governance instances or planning projects require configured activation.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-12 03:03:34 +00:00
weichenandCursor 9ba3d51a53 feat(service): implement project workflow plan, preview, and activation flow.
New projectinstance package validates three-duty separation, issues confirmation tokens, and activates immutable workflow instances; new projects start in planning mode.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-12 03:03:34 +00:00
weichenandCursor caa98d8722 feat(db): add project workflow instance tables for Phase 3 governance.
Introduce planning/active lifecycle, instance snapshots, duty assignments, and activation confirmation tokens with single-live-instance constraints.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-12 03:03:34 +00:00
weichenandCursor 28628ae141 docs(test): Phase 2 workflow designer test report and plan
Archive validator/publish test results and document Phase 2 MVP scope
boundaries ahead of Phase 3 project activation work.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-12 02:53:09 +00:00
weichenandCursor d025d13c87 feat(web): add admin workflows and template library tab
Admin console can list workflow definitions, validate/publish draft versions,
and view bootstrap template assets from the server API.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-12 02:53:09 +00:00
weichenandCursor 79ce1eb56f feat(api): add admin workflow and template management endpoints
Expose draft/validate/publish/retire workflow APIs and template upload/list
routes wired to workflowdef service with DBCatalog refresh on publish.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-12 02:53:09 +00:00
weichenandCursor 7951b0f0b5 feat(db): add workflow definitions, versions, and template asset tables
Introduce Phase 2 IAM-adjacent schema for versioned workflow definitions,
template assets/versions, and workflow_defs permissions seed.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-12 02:53:09 +00:00
weichenandCursor a9828c6f26 test(docs): Phase 1 completion gates, PG integration tests, and report
Add disabled-user 401, admin roles/sessions handler tests, optional PG store
integration, cross-project 403 fixture, and update the Phase 1 test report to
reflect completion status.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-12 02:48:00 +00:00
weichenandCursor d59246a274 feat(web): fail-closed capabilities and admin roles from server API
Stop persisting roles to localStorage as authority; AdminSettingsModal reads
and writes role matrices via /api/v1/admin/roles; hasPermission denies when
capabilities are not loaded from /auth/me.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-12 02:48:00 +00:00
weichenandCursor 39ab0ca1e4 feat(authz): complete Phase 1 admin roles, sessions, and unified admin gate
Add roles CRUD backed by system_roles tables, session list/revoke APIs,
capabilities fallback for memory mode, and route all admin checks through
AuthorizationService instead of hardcoded role-admin checks.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-12 02:47:57 +00:00
weichen 51e431e9b0 test(docs): Phase 1 IAM authz tests and test report
Extend P0 and auth/me handler tests for members endpoint and capabilities; archive Phase 1 test report under .doc/test-reports/.
2026-09-12 01:45:41 +00:00
weichen 774a767c0c feat(web): wire project members CRUD to REST API
Add projectMembers client and role adapter; sync members from server on login and modal open; persist add/update/remove via /api/v1/projects/{id}/members.
2026-09-12 01:45:41 +00:00
weichen ca9b371699 feat(web): consume server capabilities for RBAC decisions
Fetch and cache capabilities from /auth/me on login and session restore; hasPermission prefers server capabilities over local role definitions.
2026-09-12 01:39:36 +00:00
weichen 0285c8670f feat(authz): add AuthorizationService, capabilities API, and project members CRUD
Wire authz service into server, expose capabilities on /auth/me, and add project member management routes with owner/admin gates.
2026-09-12 01:39:33 +00:00
weichen f97ed2dd98 feat(auth): persist sessions and accounts via PostgresAuthStore
Add PgStore with hashed token sessions, IAM bootstrap, and store factory wiring; remove in-memory token map and allow_dev_switch from login payload.
2026-09-12 01:39:31 +00:00
weichen bc37debc31 feat(db): add IAM core migration for users, sessions, and RBAC
Introduce goose migration 00015 to extend users with IAM columns and seed system roles/permissions for Phase 1 authorization.
2026-09-12 01:39:29 +00:00
weichen 77d3da116f docs: add Phase 1 IAM and authorization implementation plan
Define the database, PostgresAuthStore, AuthorizationService, and frontend
capabilities workstream after Phase 0 security止血 is complete.
2026-09-12 01:01:20 +00:00
weichen 8341168271 test(docs): extend Phase 0 security gates and archive test report
Add P0 negative tests, prod bundle forbidden-string scan, and the Phase 0
security止血 acceptance report with PASS results.
2026-09-12 01:00:58 +00:00
weichen b600c9d518 fix(auth): restrict demo seed users to dev/test environments
Main no longer creates fixed-password demo accounts and legacy anonymous
fallback is limited to explicit dev/test in-memory fixtures.
2026-09-12 01:00:58 +00:00
weichen 00ec89a6b3 fix(security): add CORS allowlist and enforce principal on chat handlers
Replace wildcard CORS with configured origins and bind chat/task user
identity to the authenticated principal instead of request body fields.
2026-09-12 01:00:58 +00:00
weichen 867f55f1e9 fix(web): remove identity simulation and stop sending X-User-ID
Product UI no longer switches sessions locally; API clients attach Bearer
tokens only and LocalAuthClient stays test-only outside the prod bundle.
2026-09-12 01:00:58 +00:00
weichen e82b6242c7 docs: add production governance plan and Phase 0 authz matrix
Freeze terminology and document the API resource-action matrix before
security止血 changes land in application code.
2026-09-12 01:00:58 +00:00
weichen 82917799e8 docs(test): archive P0 remediation test report 2026-09-11 16:04:56 +00:00
weichen 2772c9e526 feat(security): complete P0 release blocking remediation
Unify auth middleware and remove X-User-ID trust, add project_members
authorization, sandbox workspaces via resolver, and admin-only reconcile
by run_id. Introduce goose migrations with startup schema gate, fail closed
when DB unavailable outside explicit ALLOW_IN_MEMORY, bundle web/dist in
app Dockerfile, and remove frontend pseudo-login fallback.
2026-09-11 16:04:53 +00:00
WeiCHENandCursor 8abf190e75 chore(deploy): 三环境 Compose 构建真实 app 镜像并补齐法规库运维
将 dev/test/main 的 app 服务从占位容器改为 Dockerfile 多阶段构建,增加 healthcheck 与 .regulations 只读挂载;新增法规库备份/恢复脚本并同步 env-service 目录初始化与 gitignore。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-11 19:53:24 +08:00
WeiCHENandCursor 28faa4932d fix(agent): Chat Agent 全链路 P0-P5 整改
封堵鉴权旁路与导出 IDOR,DocGov 改服务端身份;对话层 PendingAction 接真实 docgov/taskrun;修复流式租约假死与会话级任务流;加固配置/doc_id/NULL;补齐 slog 与测试;前端 ErrorBoundary 与受控文档重试。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-11 18:22:45 +08:00
WeiCHENandCursor ba249a56c8 chore: fix backfill script import and run projection for ws_intake
Remove unused import so backfill can repair run_1789111889557885000
chat message and workflow_runs for project 56 intake workspace.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-11 16:53:21 +08:00
WeiCHENandCursor 60433f2a6b feat(web): sync workflow docs from server and persist task artifact in chat
Pass doc_id on task runs, merge server deliverable state by task_key,
fetch controlled document content when opening non-template docs, and
map metadata.artifact after refresh.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-11 16:46:53 +08:00
WeiCHENandCursor bcfb9f415b feat(api): add workflow document list, content read, and backfill script
Expose project controlled documents from DocGov, serve authenticated
output.md content by doc_id, and add idempotent backfill for run_1789111889557885000.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-11 16:46:53 +08:00
WeiCHENandCursor 6e489733ec feat(agent): unify async task FinalizeTaskRun projection to chat and runs
Extend taskrun executors to return full TaskRunResult, finalize assistant
placeholder content with artifact metadata, and map quality_failed terminal
state instead of metadata-only updates.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-11 16:46:49 +08:00
WeiCHENandCursor edb6aa9e96 docs(test): add longtask P0 observer and materials test report
Archive automated regression results for stream materials, observer disconnect,
project asset upload, and ResolveMaterials assembly.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-11 15:15:17 +08:00
WeiCHENandCursor 8e966db056 feat(web): asset upload, task run observer, and session lineage on tasks
Upload binary attachments as project assets, subscribe by run_id after refresh,
and pass session_id/project_id through long-task requests.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-11 15:15:16 +08:00
WeiCHENandCursor 63cc8ab1da feat(api): observer task runs decoupled from SSE lifecycle
Add POST/GET/POST cancel task run APIs, background worker with event replay,
workspace reconcile, runner child cancel, and chat message metadata updates.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-11 15:15:15 +08:00
WeiCHENandCursor 463f7d5ea5 feat(agent): project asset upload and squad materials assembly
Register uploads via CAS, resolve project asset pools into task materials
with server-side extraction, and propagate asset_id through the bizdev/squad chain.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-11 15:15:15 +08:00
WeiCHENandCursor 7d2f86bdc4 fix(api): pass materials through task/stage stream handlers
Stream SSE path now forwards Materials to ExecuteTask/ExecuteStage, and
TestTaskStream_MaterialsInjection targets the real /tasks/run/stream endpoint.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-11 15:15:11 +08:00
WeiCHENandCursor 0c9c0928ec feat(web): wire project list and create to server API
Login syncs projects from GET /api/v1/projects; create project uses POST with server-assigned id while preserving local sessions and templates.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-11 14:28:01 +08:00
WeiCHENandCursor 4473115273 fix(web): align workbench user ids with auth seed
Unify MOCK_USERS with backend auth (admin id=1), merge session identity on login, and migrate demo seeds/tests to id 2/3/4 for 张工/李/王.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-11 14:23:31 +08:00
WeiCHENandCursor 0fc16af9a3 fix(web): keep draft when send preflight fails
Return accepted/error from handleSendMessage, clear InputArea only on success, and surface thinking/streaming feedback.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-11 14:23:28 +08:00
WeiCHENandCursor 78ad01b2da fix(web): add secure-context-safe clientTurnId helper
Provide RFC 4122 v4 fallback via getRandomValues for LAN HTTP pages where randomUUID is unavailable.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-11 14:23:25 +08:00
WeiCHEN d084056638 feat(task): inject uploaded documents into task materials and enable LAN host access
- backend: add Materials field to TaskRunRequestDTO and forward to ExecuteTask
- backend: add TestTaskStream_MaterialsInjection test case in taskstream_test.go
- web: serialize materials in buildTaskRequest and add unit test
- web: improve isSameMessage identity comparison in messageIdentity.ts
- web: configure host: '0.0.0.0' in vite.config.ts for LAN collaboration access
2026-09-11 13:22:02 +08:00
WeiCHENandCursor 78b340fd35 docs(test): chat turn idempotency automated test report
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-11 13:20:13 +08:00
WeiCHENandCursor 2c98839b91 refactor(web): stop persisting full message list to localStorage
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-11 13:20:13 +08:00
WeiCHENandCursor 29cbd5a6ad feat(web): isolate stream runtime by session and turn
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-11 13:20:13 +08:00
WeiCHENandCursor 0dbfc32603 feat(web): send stable client_turn_id and resume turns after disconnect
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-11 13:20:13 +08:00
WeiCHENandCursor 1438af18f7 feat(api): gate chat stream on chat_turns with session serial execution
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-11 13:18:16 +08:00
WeiCHENandCursor 9202ca7bf3 feat(db): add chat_turns idempotency table
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-11 13:18:16 +08:00
WeiCHENandCursor 636e2c0cb4 fix(web): guard chat window fetch races on session switch
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-11 13:17:00 +08:00
WeiCHENandCursor 35aafa288d test(web): cover real temp vs server message identity
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-11 13:16:42 +08:00
WeiCHENandCursor f431414e29 fix(web): merge live and history by serverId and clientTurnId
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-11 13:16:42 +08:00
WeiCHENandCursor 69d8f2f50d feat(api): return user_message_id in SSE turn_ack and done
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-11 13:16:42 +08:00
WeiCHENandCursor d0e0b05bc8 fix(web): disable chat stream auto-retry without idempotency
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-11 13:15:25 +08:00
WeiCHENandCursor f4da2f179f docs(spec): chat turn idempotency and session isolation
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-11 13:15:07 +08:00
WeiCHENandCursor 8c8fa4721a chore(db): add ten-project chat seed migration and generator script
Provide SQL migration and Python helper to import review demo sessions
and seed messages from tenProjectsSeed.json into Postgres.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-11 13:00:35 +08:00
WeiCHENandCursor 13e58814d7 feat(web): improve chat attachments, unread marks, and session UX
Support richer attachment payloads in input area, local read-id cache for
unread badges, and expand private-shared and chronology test coverage.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-11 13:00:34 +08:00
WeiCHENandCursor 79f86e2671 feat(web): align project templates with official reference skeletons
Replace ad-hoc markdown stubs with reference-system template baselines,
free-text device type input, and add template quality regression tests.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-11 13:00:34 +08:00
WeiCHENandCursor 2c58e2d17c fix(workflow): reconcile version conflicts in review mode and UI retry
Auto-adopt current workflow selection version in review/demo backend
paths, and retry frontend workflow switch after refreshing project version.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-11 13:00:33 +08:00
WeiCHENandCursor a865b68e36 fix(ctxmgr): normalize dismissed_unread_ids for Postgres array insert
Ensure nil dismissed ID slices serialize as empty bigint arrays and
preallocate compressDismissed output to avoid NULL write failures.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-11 13:00:31 +08:00
WeiCHEN acedc2b0ba feat(doc-preview): 上传文档多格式在线预览 + IndexedDB 持久化恢复
## 新增功能
- 支持用户上传的 Word(.docx)、PDF、Excel(.xlsx/.csv)、PPT(.pptx)、
  图像(png/jpg/svg/webp等)、纯文本/代码文件的在线高保真预览
- 预览与受控工作流文档严格隔离:上传文档走 FilePreviewPanel,
  工作流/对话入库文档继续走 BlockRenderer,互不干扰

## 核心 Bug 修复
- 修复页面刷新后上传文件无法预览/下载的根本问题
  - 根因:File 对象无法 JSON 序列化,刷新后内存引用丢失
  - 方案:新增 fileStore.ts,使用 IndexedDB 持久化文件二进制内容
  - App 启动时自动 restoreFileRawToDeliverables() 从 IndexedDB 恢复 fileRaw
  - 上传时 saveFile() 同步写入 IndexedDB(fire-and-forget)

## 下载按钮修复
- 优先从内存 File 对象动态创建 blob URL,避免依赖已 revoke 的旧 URL
- 文件内容不可用时按钮禁用并显示 tooltip 说明

## 存储层改进
- saveDeliverables() 序列化前剔除 fileRaw(不可持久化)和 blob: URL
  避免 localStorage 保存损坏的空对象

## 新增文件
- web/src/data/fileStore.ts — IndexedDB 封装(saveFile/getFile/restore)
- web/src/components/doc/preview/FilePreviewPanel.tsx — 预览面板主组件
- web/src/components/doc/preview/renderers/DocxViewer.tsx — Word 预览
- web/src/components/doc/preview/renderers/PdfViewer.tsx  — PDF 预览
- web/src/components/doc/preview/renderers/ExcelViewer.tsx — Excel 预览
- web/src/components/doc/preview/renderers/PptViewer.tsx  — PPT 预览
- web/src/components/doc/preview/renderers/ImageViewer.tsx — 图像预览
- web/src/components/doc/preview/renderers/TextViewer.tsx  — 文本预览
- web/src/tests/file-preview.test.ts — 预览功能单元测试
2026-09-11 12:58:50 +08:00
WeiCHENandCursor 5ec5fca070 feat(intent): Phase 5 V2 shadow gray flags and IntentPlan execution
Add env-based feature flags (intent_v2_shadow/decision, multi_intent,
workflow_intents), V1/V2 shadow diff reporting, expectation_plus_new plan
building, ranked-frame L2 conflict gate, and coordinator sequential query
plan execution with confirm-step deferral.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-11 11:59:16 +08:00
WeiCHENandCursor 7ae8d5f22c feat(intent): Phase 4 run control, subtypes, and limited IntentPlan
Add RUN_STATUS_QUERY/RUN_RESUME/RUN_RESTART with matcher and coordinator
handlers; write QUERY_PROGRESS/SUPPLEMENT_INFO subtypes to V2 frame; support
safe query+query multi-intent plans via IntentPlan dual-write.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-11 11:56:24 +08:00
WeiCHENandCursor e3c62fbc57 feat(intent): Phase 3 workflow/help intents and coordinator handlers
Add SWITCH/TRIGGER/QUERY workflow, doc status, help and unsupported intents
with ActionSpec registry entries, NL matchers, L2 handlers with creator-only
switch gate, router routes, and capability-aware AvailableActions.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-11 11:54:24 +08:00
WeiCHENandCursor cbe9f8c43a feat(intent): add V2 frame, ActionSpec registry, and legacy dual-write
Introduce IntentFrameV2 with goal/object/relation/evidence, register all 21
legacy intents in ActionSpec registry, and dual-write intent_frame_v2 alongside
TopIntent without changing Router/Coordinator routing.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-11 11:50:56 +08:00
WeiCHENandCursor 7efe0ba5bd fix(intent): Phase 0+1 P0 safety gates for recognition and coordination
Add golden-v1 hard-negative suite, shadow observability fields, query/command
negation gates for high-risk writes, AllowAffirmative enforcement, candidate
conflict clarification, and coordinator clarify-before-ambiguous ordering.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-11 11:49:20 +08:00
WeiCHEN 8f08a8dbe1 fix(chat): resolve intent recognition, workflow auth, and message ordering 2026-09-11 10:34:47 +08:00
WeiCHEN c72bcc8ab0 feat(project): implement modal-based project creation, creator-led member assignment, and exited-member read-only retention 2026-09-11 10:10:33 +08:00
WeiCHEN af003a3bb9 refactor(dialogue): implement task dispatch notifications and consecutive assistant messages with confirmation cards 2026-09-11 09:52:11 +08:00
WeiCHEN 82d7fe1cdc refactor(dialogue): naturalize multi-role conversations, close chat sessions with assistant response, and set URS to project shared 2026-09-11 09:42:58 +08:00
WeiCHEN 4a4f2592b8 fix(doc): resolve URS viewing and private-to-shared workflow in document pane for 10 review projects 2026-09-11 09:26:03 +08:00
WeiCHEN f3337b7bf9 feat(chat): add URS requirement document upload dialogues with attachments and phase events for all 10 projects 2026-09-11 09:03:54 +08:00
WeiCHEN 42f5b3da19 feat(chat): mount interactive review, approval, and verification confirmation cards in multi-role dialogues 2026-09-11 08:35:27 +08:00
WeiCHEN 92572138f7 fix(frontend): align MockDocumentMeta markdown property and guard nullish input in markdownToBlockAST 2026-09-11 00:58:00 +08:00
WeiCHEN 0d3cc6a6ce feat(review): seed 10 real medical device projects with dual workflows, multi-role dialogues and fix account-switch chat isolation 2026-09-11 00:47:23 +08:00
WeiCHEN dc12bc5794 fix(workflow): fix 405/404/403 errors on workflow switcher by updating CORS, 5201 demo permissions and server restart 2026-09-11 00:13:06 +08:00
WeiCHEN a51d5fcd6d chore(release): Phase 7 全链路验收报告、测试修复与发布基线归档 2026-09-10 23:57:40 +08:00
WeiCHEN 443a09d5b4 feat(workflow): Phase 6 前端项目多工作流切换器、前置依赖横幅与文档血缘失效提醒 2026-09-10 23:56:35 +08:00
WeiCHEN e9238c0ab1 feat(workflow): Phase 5 智能测试经理工作流、前置强依赖校验与文档血缘级联失效 2026-09-10 23:51:59 +08:00
WeiCHEN 9d33b1c804 feat(workflow): Phase 4 智能产品经理工作流、系统需求规格书与质量门禁 2026-09-10 23:48:40 +08:00
WeiCHEN 0961e180a3 feat(workflow): Phase 3 Coordinator 上下文、动作路由与工作流运行 API 集成 2026-09-10 23:41:24 +08:00
WeiCHEN 7c899605ea feat(workflow): Phase 1 & 2 数据库迁移、项目创建人权威化与多工作流控制面 2026-09-10 23:35:44 +08:00
WeiCHEN 484ed80377 docs(workflow): Phase 0 基线确认、架构决策记录(ADR)与契约冻结 2026-09-10 23:20:17 +08:00
WeiCHEN 4962cefdae feat(export): 实现单次智能体回复导出、私密文档保存与隐私防泄露全套闭环 (Phase 0 - Phase 2)
- Phase 0: 实现服务端回复导出策略矩阵引擎 (replyexport.EvaluatePolicy)、数据库迁移 (2026-09-11-message-export-policy.sql)、SSE done 事件挂载与能力探测 API
- Phase 1: 构建前端 ReplyDocumentIR 语法树解析与渲染管道,支持 Markdown / DOCX 文件下载及带格式富文本剪贴板复制
- Phase 2: 实现私密自由文档 (freeform_documents) 领域服务、PostgreSQL 乐观锁版本管理、ACL 隐私隔离、一键共享与右侧栏编辑联动
- 专项修复:
  1. 修复后台 API 路由注册并加入双向拉取同步,确保私密保存实时进入我的私密列表
  2. 实现轻量回复专属 DOCX 生成与静默下载逻辑 (downloadDocxReply)
  3. 将 LaTeX 公式转为标准 MathML 矢量标记,支持粘贴到 Microsoft Word / WPS 自动识别为原生公式
2026-09-10 23:04:04 +08:00
WeiCHEN 779c6c7f04 test(chat): add session turn_intent metadata assertion and chip category navigation tests 2026-09-10 16:10:53 +08:00
WeiCHEN 2c0c6a0348 feat(category): implement recategorize backfill engine and fallback mapping (Spec §3.4-3.5 A4-A5) 2026-09-10 15:56:53 +08:00
WeiCHEN 5a83b9fa44 feat(chat): 完成分类锚点坞(CategoryDock)与双轨制未读重构 (含方案A轮次归一化与起始位置居中) 2026-09-10 15:44:05 +08:00
WeiCHEN 76dae2dc3f fix(nav): 修复点击项目会话时因 URL hash 监听重放导致被强制回弹选中第一个项目的 bug 2026-09-10 14:33:48 +08:00
WeiCHEN 709fadcef2 feat(history): 完成 Phase P3 虚拟滚动、聊天记录导出与协同未读提醒
- 虚拟滚动:接入 @tanstack/react-virtual,封装 useVirtualMessages 动态测高与 overscan 预渲染,迁移 anchorNavigator 锚点定位与 SSR 兼容降级
- 聊天记录导出:基于既有 docx 与 xlsx 依赖实现 chatExporter 与 ChatExportModal,新增服务端 /api/v1/chat/export/messages 支持按条件导出
- 协同未读标记:新增 useUnreadMarks 30s 轮询与服务端 /api/v1/chat/unread 接口,日历格与工具栏支持橙色未读徽标提示
- 测试与验证:新增 chat_unread_and_export_api_test.go,前端全量 126 项单元/组件测试及生产打包 100% 通过
2026-09-10 14:25:13 +08:00
WeiCHEN de015d694a feat(history): 实现三模历史搜索、每日智能协同摘要与时间轴侧栏 (Phase P2) 2026-09-10 13:53:07 +08:00
WeiCHEN ad57685665 feat(history): 实现多级历史导航、分类筛选、日历联动与消息双向引用 (Phase P1)
- 后端核心与 API:
  - 实现 ChatCategoryStat 结构体与 ListChatCategories 统计引擎 (Postgres + In-Memory 内存降级双轨)
  - 注册 GET /api/v1/chat/categories 聚合接口
  - 增强 GetChatDayMessages 支持自动根据 anchor_id 逆查 day_key,实现免猜测跨日检索
- 前端锚点导航引擎:
  - 实现 anchorNavigator 模块 (快路径 DOM scrollIntoView + 1.8s 发光脉冲、慢路径跨日拉取、深链 Hash 解析)
  - 编写 anchorNavigator.test.ts 单元测试并 100% 通过
- 分类过滤与轻量月历:
  - 实现 CategoryFilterBar 水平分类筛选栏 (8 类业务标签,暗淡/高亮模式)
  - 实现 HistoryCalendar 零依赖原生悬浮月历组件 (热度点与消息数,jumpToDate 快速定位)
- 消息引用与双向追溯:
  - 消息气泡悬浮“引用”入口,点击提取发言人与摘要至输入框
  - 实现 QuoteChip 待发引用标签与 QuoteCard 已发引用卡片
  - 引用卡片点击直连锚点定位,快慢路径自动回溯
2026-09-10 13:40:44 +08:00
WeiCHEN 2ece0ce882 feat(history): 实现超长对话历史按日归档与滑动窗口 (Phase P0) 2026-09-10 13:24:32 +08:00
WeiCHEN cf966dcf77 feat(prompt+cache): implement 10-section prompt template, true KB regulation recall, behavior rules and multi-level caching (P4) 2026-09-10 11:52:40 +08:00
WeiCHEN b75a06cc1a feat(coordinator): implement determinism-first query rewrite with ellipsis completion and pronoun resolution (P3) 2026-09-10 11:46:27 +08:00
WeiCHEN 2c3e303561 feat(ctxmgr): implement chat memory vectorization, privacy dual-gate retrieval and memory composer (P2) 2026-09-10 11:38:36 +08:00
WeiCHEN 30bfc1fd2f feat(ctxmgr): implement sliding window, rolling summarizer and DST task state (P1) 2026-09-10 11:19:08 +08:00
WeiCHEN 6a88ceb94d feat(chat): wire multi-turn dialogue broken links (G1/G2/G3/G9) with session restore 2026-09-10 11:05:14 +08:00
WeiCHEN 143d94ffdf docs(design): add multi-turn dialogue optimization system design (report 03) 2026-09-10 11:05:12 +08:00
WeiCHEN 747cd39e97 feat(core): update backend coordinator, docgov lease, squad workflow and web governance integration 2026-09-10 09:38:35 +08:00
WeiCHEN d40de5fe61 fix(web): wire ALL_MOCK_DOCUMENTS and project deliverables to fix document switching 2026-09-10 09:37:53 +08:00
WeiCHEN 8362802d37 feat(scripts): add launch.sh to detect-and-restart dev stack (compose, backend, web) 2026-09-09 20:46:49 +08:00
WeiCHEN 7feabff181 fix(web): render step_failed phase as failed strip node with retry reset 2026-09-09 20:25:07 +08:00
WeiCHEN 82aa6ab322 docs(test): archive long-task phase live/resume UX real-agent report 2026-09-09 19:22:13 +08:00
WeiCHEN 99e0d4a412 fix(web): distinguish recovery action styles for long-task failures 2026-09-09 18:49:36 +08:00
WeiCHEN 873e6d0a83 feat(web): drive long tasks from SSE with live phases and continue/restart recovery 2026-09-09 18:48:26 +08:00
WeiCHEN 1d81d6acf1 feat(web): add task SSE client and live phase-event mapper 2026-09-09 18:41:02 +08:00
WeiCHEN 7c1383768f test(server): task stream transient injection, classification and resume integration tests 2026-09-09 18:35:51 +08:00
WeiCHEN 0b846e132a feat(api): task stream request-id, resume mode and workspace-aware error classification 2026-09-09 18:27:29 +08:00
WeiCHEN 870d0462c4 docs(spec): add long-task phase live/resume UX P2 spec and plan 2026-09-09 18:19:53 +08:00
WeiCHEN 1e7cb67ab4 docs(spec): archive chat wait-error-retry UX spec and implementation plan 2026-09-09 18:10:12 +08:00
WeiCHENandCursor 0c7d974ae2 fix(web): escape HTML in chat markdown rendering
Prevent self-XSS when chat bubbles render user/LLM markdown via
dangerouslySetInnerHTML by escaping raw HTML after math/code
extraction and sanitizing link href schemes.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-09 17:48:12 +08:00
WeiCHENandCursor a964899f51 docs(test): strengthen chat wait-error-retry report with web E2E evidence
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-09 17:41:02 +08:00
WeiCHENandCursor 4aa839c5d1 docs(test): archive chat wait-state error-retry UX real-agent report
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-09 17:23:31 +08:00
WeiCHENandCursor 56fb3180c2 fix(web): scope Task 5 App.tsx to SSE wiring only
- Rebased App.tsx on the last clean Task-4 parent (5aa8129) and re-applied
  only Task-5's SSE plumbing: streamAbortRef, isStreamingActive,
  buildNetworkErrorInfo, runStreamAttempt, handleErrorAction,
  handleStopStreaming, and the InputArea/MessageStream wiring.
- Removed the unscoped WIP that had been folded into b2cf863 (NeuroPulse
  demo data/session-privacy/docgov-lease/cardActionPolicy imports that do
  not exist in git, causing b2cf863 to fail to build in isolation).
- Real-backend path now appends the pending placeholder and calls
  runStreamAttempt immediately; the artificial setTimeout(600) is only
  used for the mock keyword-shortcut demo branches (unchanged from 5aa8129),
  gated by precomputed predicates so it never wraps the SSE call.
- Preserved 5aa8129's mock keyword shortcuts (生成文档/驳回/修改/通过等) verbatim.
- No silent success-template fallback re-introduced.
- P1 error actions remain filtered to retry-only; auto-retry transient
  attempts stay capped at 2 with 1s/2s backoff via AbortController.
- Bloated WIP App.tsx backed up to .superpowers/sdd/App.tsx.wip-backup
  for later use by whichever task owns NeuroPulse/session-privacy/docgov
  lease work.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-09 17:07:44 +08:00
WeiCHENandCursor b2cf8637a3 feat(web): drive chat bubbles from SSE with auto-retry and stop
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-09 16:47:52 +08:00
WeiCHENandCursor 5aa812943c feat(web): render chat wait-state and structured error actions in bubbles
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-09 16:36:49 +08:00
WeiCHENandCursor 6d32fc68f3 fix(web): drop out-of-scope ProjectSession.userId from Task 3
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-09 16:32:31 +08:00
WeiCHENandCursor 357aab3ba7 feat(web): add chat SSE client and transient auto-retry helpers
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-09 16:30:48 +08:00
WeiCHENandCursor ccc485a670 fix(agent): scope Task 2 to SSE phases/errors without dialogue_llm leak
- untrack internal/coordinator/dialogue_llm.go (kept on disk untracked as local WIP for a future dialogue-LLM commit with its own tests; it depends on engine.go fields (dialogueBackend, ReplySource) not yet committed)
- slim internal/chat/session.go back to Task 2 scope relative to bfa6889: keep EmitErrorInfo(stream.ClassifyError(...)) for intent+coordination errors and the dialogue_generating EmitPhase before ProcessIntent; drop sync.Mutex/mu, ChatResponse.ReplySource, preference/RecentDialogue injection block, and collectRecentDialogue helper (unrelated WIP for the dialogue-LLM feature)

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-09 16:25:35 +08:00
WeiCHENandCursor 8f29d84908 feat(agent): emit dialogue phases and classified SSE errors with request id
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-09 16:16:25 +08:00
WeiCHENandCursor bfa68892ac fix(stream): avoid dial substring false-positive in ClassifyError
Remove "dial" from networkHints to stop "dialogue" misclassification;
extend workspace/resumable and EmitErrorInfo test coverage.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-09 16:09:39 +08:00
WeiCHENandCursor f385515ad3 feat(stream): add structured ErrorInfo and error classification
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-09 16:08:04 +08:00
WeiCHENandCursor a8701bc08c fix(web): redesign auth and settings UI using system design tokens and high-fidelity styles
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 23:40:40 +08:00
WeiCHENandCursor 1c7320b1c4 docs(test): archive auth and dual settings test report
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 23:32:15 +08:00
WeiCHENandCursor f38572c0af feat(web): integrate auth guards, dual settings and dev switcher
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 23:31:06 +08:00
WeiCHENandCursor 28e7f3af14 feat(web): implement dedicated AdminSettingsModal for role-admin
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 23:26:41 +08:00
WeiCHENandCursor fc95ef6fed feat(web): implement dedicated UserSettingsModal
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 23:24:47 +08:00
WeiCHENandCursor 2c61a08bcf feat(web): add LoginView and FirstLoginPasswordModal components
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 23:23:49 +08:00
WeiCHENandCursor eb522e7285 feat(web): add frontend auth types and api client
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 23:20:33 +08:00
WeiCHENandCursor d548f773bc feat(api): add auth and admin management endpoints
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 23:19:04 +08:00
WeiCHENandCursor f7bc32798b feat(auth): add auth data models, config and store engine
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 23:17:03 +08:00
WeiCHENandCursor cf9c8415b4 docs(plan): add auth and dual settings implementation plan
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 23:15:18 +08:00
WeiCHENandCursor 169631c54b docs(spec): add auth and dual settings design specification
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 23:14:23 +08:00
WeiCHENandCursor 372d241601 test(rbac): archive dynamic roles and doc visibility rbac test report
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 22:41:04 +08:00
WeiCHENandCursor 909448e5ea feat(web): wire rbac permission enforcement into left rail and rights modal
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 22:40:22 +08:00
WeiCHENandCursor e1071f74e1 feat(web): add doc visibility override modal and badges in deck drawer
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 22:36:55 +08:00
WeiCHENandCursor fa2d0e9837 feat(web): upgrade settings modal with dynamic roles CRUD and permission matrix
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 22:33:41 +08:00
WeiCHENandCursor d1202038d8 feat(rbac): implement permission evaluation engine and unit test suite
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 22:31:50 +08:00
WeiCHENandCursor 6287731885 feat(rbac): define rbac data contracts and extend deliverable and user types
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 22:30:39 +08:00
WeiCHENandCursor a7eef6f63b docs(plan): add dynamic roles and doc visibility rbac implementation plan
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 22:29:36 +08:00
WeiCHENandCursor 3d75471dc2 docs(spec): add dynamic roles and doc visibility rbac design spec
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 22:27:17 +08:00
WeiCHENandCursor 2745e89ed3 test(engine): add integration tests and archive test report for project template cloning
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 20:42:15 +08:00
WeiCHENandCursor b56ca45ad4 feat(web): wire project isolation and template cloning on project creation
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 20:41:05 +08:00
WeiCHENandCursor 061789e5d7 feat(web): add template status badges to deck drawer and tab bar
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 20:38:06 +08:00
WeiCHENandCursor a527f4dcd4 fix(engine): 修复 DOCX 公式因 undefined 虚根在 Word 中丢失的缺陷
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 20:37:28 +08:00
WeiCHENandCursor 29efa0d348 feat(engine): add project template cloning factory and unit tests
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 20:36:02 +08:00
WeiCHENandCursor a3daabf4d9 refactor(types): extend deliverable item with projectId and isTemplateOnly
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 20:35:04 +08:00
WeiCHENandCursor 0cf23df338 docs(plan): add project init template cloning implementation plan
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 20:31:07 +08:00
WeiCHENandCursor 23cf8c3a1e docs(spec): add project init template cloning design spec
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 20:28:54 +08:00
WeiCHENandCursor 50f95c61ed docs(test): 补充 Canvas Tainted 缺陷排查与修复验证记录
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 20:25:50 +08:00
WeiCHENandCursor 3c6b4baa2a test(engine): 增加 cleanSvgForCanvas 净化与防污染单元测试
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 20:25:33 +08:00
WeiCHENandCursor 345cd54fb9 fix(engine): 修复 Mermaid 导出时的 Canvas Tainted 污染与 toBlob 异常
- 配置 Mermaid flowchart.htmlLabels 为 false,禁用 foreignObject 嵌入式 HTML 标签
- 实现 cleanSvgForCanvas 深度净化 SVG,剥离 @import 与将 foreignObject 转为原生 SVG <text>
- 替换异步 toBlob/FileReader 为同步 toDataURL + atob,并在 img.onload 中增加安全沙箱 try/catch 兜底

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 20:25:30 +08:00
WeiCHENandCursor c517b4a25b docs(test): 归档 DOCX 原生公式、Mermaid 与排版优化测试报告
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 20:17:09 +08:00
WeiCHENandCursor c4f30eb26f test(engine): 增加 DOCX 行内 OMML 复合解析与公式转换单元测试
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 20:17:05 +08:00
WeiCHENandCursor dd67aacf49 feat(engine): 实现 DOCX 原生 OMML 数学公式、Mermaid 高清渲染与出版级公文排版
- 集成 mathml2omml 与 KaTeX,实现展示级公式 (<m:oMathPara>) 与行内公式 (<m:oMath>) 的微软原生矢量公式渲染
- 实现 svgToPngData 将 Mermaid 矢量图光栅化为 2.5x 视网膜清晰度的 PNG 图片嵌入 Word
- 重构公文抬头、4列受控签署栏、出版级三线表、keepNext 防孤行与带分割线的受控页眉页脚

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 20:17:01 +08:00
WeiCHENandCursor 3d6df3feb7 fix(cli): adapt default stage by role and add scanner error checking
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 19:15:34 +08:00
WeiCHENandCursor e1864905c8 docs(test): archive test report for dialogue-driven content and hierarchical intent system
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 19:05:59 +08:00
WeiCHENandCursor 776333e1ec feat(web): integrate interactive cards into chat stream and wire docgov actions
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 18:58:21 +08:00
WeiCHENandCursor 649290bbba fix(web): add 60s grace period undo, executing banner and ttl safeguards to interactive card
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 18:45:10 +08:00
WeiCHENandCursor 1c62be6e49 feat(web): build interactive card component with lifecycle and idempotency
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 18:33:36 +08:00
WeiCHENandCursor 6e4fe22bfb fix(coordinator): chain expectation for card confirmation and add ttl lifecycle cleanup
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 18:22:13 +08:00
WeiCHENandCursor 73b50926e4 docs(test): 归档 DOCX/XLSX 导出与会话隔离持久化测试报告
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 18:09:59 +08:00
WeiCHENandCursor 275b4ebd63 test(workbench): 增加 DOCX/XLSX 导出与会话隔离单元测试
- 验证 DOCX 二进制 Buffer 生成、TextRun 解析与 Blob 输出
- 验证 XLSX 多表提取、自适应列宽与工作簿 Sheet 命名规范
- 验证 sess-001 与 sess-002 对话隔离及动态追加互不串线

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 18:09:56 +08:00
WeiCHENandCursor 7e8f0cd4f7 feat(ui): 顶栏综合导出下拉选择器与 App 消息隔离及存储打通
- SlimTabBar: 增加导出格式气泡下拉菜单,支持一键导出 Word DOCX、Excel XLSX、Markdown MD
- App: MessageStream 严格根据 activeSessionId 过滤消息流,杜绝多项目会话串线
- App: 新建项目自动注入独立引导语,全流程与 storage 自动双向同步

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 18:09:51 +08:00
WeiCHENandCursor 9fc45ab3e3 feat(storage): 实现多项目会话隔离与 localStorage 全局刷新持久化
- 预设 sess-001 (4K内窥镜) 与 sess-002 (掌上超声) 独立初始消息流
- safeGetItem/safeSetItem 包装器防御性存取 sessions, activeSessionId, messages, deliverables
- 确保页面刷新后用户发送的所有内容、回复及即时生成的私密文档零丢失

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 18:09:47 +08:00
WeiCHENandCursor 58623605bc feat(engine): 实现 DOCX 与 XLSX 客户端原生渲染导出引擎
- 引入 docx 与 xlsx 依赖,纯前端无损编译 Block AST 交付物
- buildDocxModel: 自动生成两行四列受控签署栏、多级编号标题、Markdown富文本、医疗标准三线表、Cambria Math公式与动态页眉页脚
- buildXlsxWorkbook: 自动提取文档概览与全部数据表格,生成带自适应列宽的 Excel 工作簿并支持直接下载

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 18:09:43 +08:00
WeiCHENandCursor c1c299b4ab feat(coordinator): implement docgov gates, semantic anchoring and interactive card dispatch
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 18:07:56 +08:00
WeiCHENandCursor a7ee616afc feat(ui): 升级顶栏为极简级联面包屑架构,自适应 320px 极窄视窗
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 17:56:30 +08:00
WeiCHENandCursor 473fe7ec76 fix(intent): address review findings for hierarchical intent funnel and security guards
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 17:53:39 +08:00
WeiCHENandCursor 8a8582056c feat(intent): implement 4-stage hierarchical intent funnel and slot extraction
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 17:42:57 +08:00
WeiCHENandCursor 003a899785 fix(doc): 完善文档系统各层级标题、图表公式与有序列表自动编号引擎
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 17:41:59 +08:00
WeiCHENandCursor 5dc58322aa feat(intent): add interactive card payload and extended intent contracts
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 17:31:52 +08:00
WeiCHENandCursor 8aa0698dfb docs(plan): add implementation plan for dialogue-driven content synthesis and hierarchical intent funnel
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 17:27:00 +08:00
WeiCHENandCursor db238a467a docs(spec): add specification for dialogue-driven content synthesis and hierarchical intent funnel
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 17:01:27 +08:00
WeiCHENandCursor dcc06502b4 test(doc): 完善三分类隐私隔离与流转单元测试并归档全量测试报告
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 16:50:17 +08:00
WeiCHENandCursor 8967f2b48b feat(ui): 实现三分类Tab分段切换、全景大盘分区与一键共享/取消共享闭环
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 16:50:11 +08:00
WeiCHENandCursor 3206304a57 fix(chore): 修正.gitignore根目录data规则并纳入前端mockDocuments
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 16:50:06 +08:00
WeiCHENandCursor a95b92da31 feat(types): 升级交付物数据契约支持工作流/共享/私密三分类与创作者属性
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 16:49:40 +08:00
WeiCHENandCursor 7bbfddccd4 fix(layout): 修复边栏拖拽位移累加并实现1:1光标捕获绝对跟随
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 16:49:36 +08:00
WeiCHENandCursor 59c3e83606 feat(ui): 修复模态背景穿透、公式/富文本Markdown解析并集成右键快捷菜单
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 16:49:30 +08:00
WeiCHENandCursor 904696ad10 docs(spec): 归档三层交付物分类治理与多用户隐私/共享设计规范与实施计划
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 16:49:25 +08:00
WeiCHENandCursor 6d3bbd9496 chore(web): update package-lock.json with tsx
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 14:53:12 +08:00
WeiCHENandCursor 988a8e5462 docs(test): add three-column workbench and block document engine test report
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 14:52:47 +08:00
WeiCHENandCursor b80a6863c7 feat(server): integrate web spa static assets hosting and route fallback
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 14:51:50 +08:00
WeiCHENandCursor 916bddc04f feat(web): complete in-place block editing, reviewer comments, and role governance loop
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 14:50:48 +08:00
WeiCHENandCursor 267b8c89a5 feat(web): implement 36px slim tabs, deck drawer, and block views with medical styling
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 14:47:57 +08:00
WeiCHENandCursor 171b42510e feat(web): implement agent chat stream with thinking pulse indicator and case cards
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 14:46:08 +08:00
WeiCHENandCursor 1ed455ab73 feat(web): implement responsive three-column shell with resizable rails and theme switch
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 14:44:54 +08:00
WeiCHENandCursor 4d9dfbb027 feat(web): implement markdown block ast converters and auto-numbering engine
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 14:43:21 +08:00
WeiCHENandCursor 915b35232c feat(web): define block ast, workbench session, and docgov types
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 14:41:30 +08:00
WeiCHENandCursor 952c73e9a5 feat(web): initialize react 19 vite typescript scaffold and token design system
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 14:40:51 +08:00
WeiCHENandCursor 19461e594a docs(plan): add three-column modern workbench and block document engine implementation plan
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 14:37:35 +08:00
WeiCHENandCursor 46741bcf13 docs(spec): refine right rail with 36px slim tabs and deck panel drawer
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 14:36:39 +08:00
WeiCHENandCursor 0b62403b8b docs(spec): add three-column modern workbench and block document engine specification
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 14:34:12 +08:00
WeiCHENandCursor a695334ac6 docs(test): 归档历史多轮会话持久化与标杆案例语义推荐标准化实测报告
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 14:01:52 +08:00
WeiCHENandCursor 1ec53b76d8 feat(cli): 终端自推荐标杆案例渲染与全业务链 E2E 端到端回归实操
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 14:00:59 +08:00
WeiCHENandCursor 7416a9fb35 feat(server): 新增会话列表、多轮历史消息查询与标杆案例语义检索 RESTful API
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 13:44:05 +08:00
WeiCHENandCursor f111fb19ae feat(coordinator): 在贴身业务参谋决策锦囊中注入相似标杆案例自推荐
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 13:43:08 +08:00
WeiCHENandCursor 0f1f0c6713 feat(ctxmgr): 增加已批准受控文档自动切片向量化与标杆案例语义检索
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 13:39:59 +08:00
WeiCHENandCursor e6aab19b89 feat(ctxmgr): 增加历史多轮会话列表查询、消息拉取与会话重构引擎
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 13:37:36 +08:00
WeiCHENandCursor d92e3dee42 feat(ctxmgr): 增加离线确定性高维嵌入生成器与向量字面量工具
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 13:34:44 +08:00
WeiCHENandCursor 316ec475ed docs(plan): 编制历史多轮对话持久化与标杆案例语义检索实施计划
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 13:33:25 +08:00
WeiCHENandCursor dd36da4aa7 docs(spec): 编写历史多轮对话持久化与已批准交付物标杆案例语义检索设计规范
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 13:31:39 +08:00
WeiCHENandCursor 86d9e31c00 docs(test): 归档全业务链成熟度端到端贯通与受控文档治理实操测试报告
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 13:20:19 +08:00
WeiCHENandCursor 3abc6a5921 test(bizdev): 新增全业务链成熟度螺旋推进(V0.1->V0.5->V1.0)端到端贯通测试
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 13:20:15 +08:00
WeiCHENandCursor b273b33095 feat(cli): 升级 bizdev-cli 阶段执行器支持流式进度与文档治理拦截
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 13:20:11 +08:00
WeiCHENandCursor 72737e3565 feat(bizdev): 贯通跨阶段事实黑板自动传承与里程碑决策记录
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 13:20:07 +08:00
WeiCHENandCursor 5a1a75870d feat(ctxmgr): 支持跨阶段项目事实黑板与成熟度状态持久化
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 13:20:04 +08:00
WeiCHENandCursor 275c3ca157 docs(test): archive 2026-09-08 HTTP API and SSE context integration test report
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 13:07:37 +08:00
WeiCHENandCursor c1e2575e0a test(api): add e2e integration tests for claimed document SSE and docgov RESTful APIs
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 13:07:31 +08:00
WeiCHENandCursor 8ff574c08b feat(api): add RESTful endpoints and SSE streams for context and docgov lifecycle
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 13:07:26 +08:00
WeiCHENandCursor 1c6dd6cfb8 feat(service): emit governance interception and progress summary on claimed documents
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 13:07:20 +08:00
WeiCHENandCursor b5d29e11cd feat(stream): add governance event and lightweight progress summary protocol
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 13:07:13 +08:00
WeiCHENandCursor ac0b6d412e test(docgov): 增加编制审核批准全流程自动化测试与测试报告归档
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 12:01:58 +08:00
WeiCHENandCursor c533523755 feat(agent): 将文档治理生命周期与认领拦截挂钩至BizDev服务与CLI工具链
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 12:01:49 +08:00
WeiCHENandCursor 2ca662ba72 feat(service): 实现文档编制审核批准生命周期、权限控制与认领闭环引擎
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 11:48:59 +08:00
WeiCHENandCursor 42fff9dfdb feat(db): 增加受控文档编制审核批准生命周期与认领治理Schema
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 11:46:33 +08:00
WeiCHENandCursor 400f5a6764 docs(test): 归档多级上下文管理与记忆衰减引擎真实Agent实测报告
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 11:21:26 +08:00
WeiCHENandCursor e88a47db6d feat(agent): 增强上下文沙箱指引、搜索过滤与CLI用户ID上下文透传
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 11:21:18 +08:00
WeiCHENandCursor 67e52ffd42 feat(agent): 实现混合上下文装配引擎(Context Blender)与智能体小队沙箱对接
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 10:23:28 +08:00
WeiCHENandCursor 73e053e8e0 feat(service): 实现单用户/项目多级上下文模型、时间衰减与用户习惯偏好管理
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 10:18:31 +08:00
WeiCHENandCursor 00c36083f4 feat(storage): 实现CAS物理文件寻址与向量切片防爆炸去重引擎
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 10:16:14 +08:00
WeiCHENandCursor 38aac97d24 feat(db): 部署专属记忆与多级上下文数据库容器与pgvector初始化Schema
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 10:13:54 +08:00
WeiCHENandCursor caf07388e0 docs(test): 归档流式传输服务与按需呈现交互规范测试报告
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 09:33:50 +08:00
WeiCHENandCursor e938c99468 test(api): 补充SSE流式长连接端到端自动化测试套件
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 09:33:03 +08:00
WeiCHENandCursor 856269a965 feat(cli): 终端支持动态阶段状态流式输出与低认知负荷摘要呈现
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 09:19:41 +08:00
WeiCHENandCursor dce8431b82 feat(api): 实现HTTP服务骨架与Server-Sent Events流式交互接口
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 09:17:37 +08:00
WeiCHENandCursor f43d3687c1 feat(agent): 在小队编排与任务生命周期中打通阶段性状态与摘要流式通知
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 09:14:58 +08:00
WeiCHENandCursor 8289443e45 feat(service): 建立多层级流式事件发射模型与Context穿透引擎
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-08 09:09:41 +08:00
WeiCHENandCursor 3bdd6dd043 docs(test): 归档多领域知识中枢与专属法规知识库解耦集成测试报告
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 23:56:26 +08:00
WeiCHENandCursor 79b03ad916 feat(agent): 配置法规可行性评估报告专属三阶段智能体工作流
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 23:56:24 +08:00
WeiCHENandCursor 566bfa8611 feat(agent): 智能体小队工作区动态法规检索与上下文注入
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 23:47:21 +08:00
WeiCHENandCursor d43822b8d5 feat(service): 实现嵌入式多领域知识中枢与Hybrid RRF检索引擎
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 23:46:22 +08:00
WeiCHENandCursor 0f21060bce feat(db): 启动本项目专属知识库容器并完成法规数据无损迁移与解耦
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 23:40:23 +08:00
WeiCHENandCursor d8a7254c1b docs(report): 补充归档真实Agent全流程业务测试报告
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 23:16:46 +08:00
WeiCHENandCursor ac243112a4 docs(report): 归档智能体小队自适应规划真实后端集成测试报告与设计方案
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 23:16:41 +08:00
WeiCHENandCursor 80b35ac069 test(chat): 添加基于真实Agent工作区的多轮人机交互E2E测试用例
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 23:16:37 +08:00
WeiCHENandCursor f181529195 feat(intent): 增强目标市场槽位意图匹配与上下文兼容推断
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 23:16:35 +08:00
WeiCHENandCursor 4737316d26 feat(squad): 优化质量门禁章节规范化匹配与审核专员预置草稿流转
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 23:16:32 +08:00
WeiCHENandCursor 889e775f01 feat(squad): 打通成果物基准假设附录挂载、协调层自适应回显与CLI非标文档执行
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 22:30:13 +08:00
WeiCHENandCursor af2d3b09d4 docs(rules): enforce real agent execution standard for delivery verification
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 22:27:46 +08:00
WeiCHENandCursor abd0893e12 feat(squad): 实现单步评估器StepEvaluator与工作流动态加步、跳步及基准假设推断
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 22:27:06 +08:00
WeiCHENandCursor 37664ad7c8 feat(squad): 实现自适应任务规划器AdaptivePlanner支持固定流微调与非标文档自治拆解
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 22:22:50 +08:00
WeiCHENandCursor 0737a6780c feat(squad): 实现角色资产中心RoleRegistry支持8大标准角色与临时专员派生
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 22:20:56 +08:00
WeiCHENandCursor 486fbf1977 feat(squad): 增强领域核心模型支持角色来源、自适应步骤与黑板基准假设
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 22:19:57 +08:00
WeiCHENandCursor 8a2c537445 docs(test): establish test report standards and generate three-branch intent framework report
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 22:16:04 +08:00
WeiCHENandCursor 2456141f67 feat(cli): add three-branch interaction feedback and comprehensive verification test cases
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 22:11:54 +08:00
WeiCHENandCursor a0a9b03e28 feat(chat): integrate non-blocking pending expectation and topic preemption in session
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 22:11:51 +08:00
WeiCHENandCursor 017b53d634 feat(coordinator): refactor advisor persona and assemble next expectation drafts
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 22:11:48 +08:00
WeiCHENandCursor d3251dee0b feat(intent): implement three-branch flexible intent resolution and expectation contracts
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 22:11:45 +08:00
WeiCHENandCursor 3a15143fa7 feat(coordinator): 增强工作区阶段元数据持久化与上下文自动关联
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 21:38:59 +08:00
WeiCHENandCursor b1484a7a9b feat(cli): CLI支持-chat交互式对话REPL与单次自然语言指令调度
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 21:34:51 +08:00
WeiCHENandCursor bd33d9645e feat(chat): 封装L1会话管理器打通自然语言多轮人机交互闭环
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 21:34:47 +08:00
WeiCHENandCursor 70c96f2f3d feat(coordinator): 实现L2统一上下文组装器与意图校验调度引擎
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 21:34:43 +08:00
WeiCHENandCursor d0ca8bed54 feat(intent): 定义核心意图契约并实现基于上下文约束的规则意图识别器
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 21:34:39 +08:00
WeiCHENandCursor e2759394ca docs(system): 纳管系统架构设计与演进规划文档
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 21:27:21 +08:00
WeiCHENandCursor 7346fcae64 feat(cli): CLI支持成熟度阶段执行与业务参谋锦囊可视化
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 21:27:10 +08:00
WeiCHENandCursor 6502d35e50 feat(bizdev): 实现成熟度三阶段编排与AdvisorBriefing双轨交付
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 21:27:05 +08:00
WeiCHENandCursor 9030cb9dd1 feat(squad): 修复stub字段覆盖并增强质量门禁闭环与锚点提取
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 21:27:01 +08:00
WeiCHENandCursor 003d99ab67 test(squad): add comprehensive tests for workspace, context, workflow, quality gate, and cli
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 18:23:59 +08:00
WeiCHENandCursor 63e4af2db5 feat(cli): upgrade bizdev-cli with dynamic inspection, step manipulation, and manifest display
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 18:23:55 +08:00
WeiCHENandCursor da9c63debe feat(service): integrate squad service and ports into bizdev domain service
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 18:23:51 +08:00
WeiCHENandCursor 14ef73677e feat(quality): implement 3-tier quality gate, manifest auditing, and quote backfill
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 18:23:47 +08:00
WeiCHENandCursor 0f17f74cc2 feat(workflow): implement dynamic workflow driver with sub-workspace isolation
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 18:23:42 +08:00
WeiCHENandCursor d0c6559dd6 feat(context): implement self-describing context system with authority guide
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 18:23:39 +08:00
WeiCHENandCursor b0142ab026 feat(squad): define workspace directory metadata models and engine
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 18:23:35 +08:00
WeiCHENandCursor cd39a52dce feat(agent): ensure clean container and isolate workspace artifacts strictly to host volume
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 17:51:50 +08:00
WeiCHENandCursor 953a99ab83 docs(env): update environment configuration template with MiniMax and Tavily pool
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 17:31:45 +08:00
WeiCHENandCursor 4929b1842c chore(docker): integrate pi-agent service in dev, test, and main compose files
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 17:31:39 +08:00
WeiCHENandCursor 38406f5e0b test(agent): add Tavily pool rotation and PiAgent remote runner tests
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 17:31:35 +08:00
WeiCHENandCursor ab26e5d161 feat(agent): support PI_AGENT_RUNNER_URL remote execution in PiAgentBackend
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 17:31:31 +08:00
WeiCHENandCursor fabdb51e65 feat(agent): add pi-agent container assets with dynamic MiniMax config and HTTP runner
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 17:31:27 +08:00
WeiCHENandCursor 1edf5f60ab feat(agent): add Tavily search extension with API key pool and auto-rotation
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 17:31:23 +08:00
WeiCHENandCursor 02f04f3851 fix(agent): pass absolute workDir and parse bridge JSON response
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 17:15:16 +08:00
WeiCHENandCursor 840541794a fix(all): resolve whole-branch review findings on Excel labels, persona forwarding, and error handling
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 17:00:40 +08:00
WeiCHENandCursor 8dc315b690 feat(cli): add bizdev-cli runner tool and integration tests
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 16:47:28 +08:00
WeiCHENandCursor ad18561da6 fix(service): populate Excel pricing cells and verify attachment readback parity
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 16:44:55 +08:00
WeiCHENandCursor 7a41b4f5be fix(service): backfill CDO quote markdown table from excel summary and align workspace
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 16:41:29 +08:00
WeiCHENandCursor d97098371d feat(service): implement bizdev service with independent task drivers
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 16:38:55 +08:00
WeiCHENandCursor 8c000f0b2d chore(tools): add package.json for cursor-bridge and pi-bridge
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 16:37:44 +08:00
WeiCHENandCursor a7d30a2c7a feat(agent): implement cursor-cli, pi-agent, and stub backend adapters
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 16:36:15 +08:00
WeiCHENandCursor b3026d3c5b feat(quote): implement CDO quote Excel calculation and fill engine
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 16:34:01 +08:00
WeiCHENandCursor 543babf621 feat(template): add self-describing templates and agent personas
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 16:30:52 +08:00
WeiCHENandCursor 6f44916bfb feat(kb): add regulation knowledge base client with snapshot materialization
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 16:27:51 +08:00
WeiCHENandCursor 40a25f9bd0 chore(config): initialize go module and configuration loader
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 16:25:45 +08:00
WeiCHENandCursor 76e6acaff4 docs(plan): add bizdev squad and templates implementation plan
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 16:23:34 +08:00
WeiCHENandCursor b14fc71922 chore(config): add .env.example with cursor, pi-agent, and kb variables
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 16:16:10 +08:00
WeiCHENandCursor 4c97de4f8e docs(spec): add business docking squad and templates design spec
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 16:15:47 +08:00
WeiCHENandCursor d78c6e4fa6 chore(rules): 配置 Cursor 持久化规则以约束三分支模型与环境隔离规范
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 15:59:27 +08:00
WeiCHENandCursor dd7675eb89 feat(scripts): 增加多环境一键启停管理与分支工作流辅助脚本
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 15:59:25 +08:00
WeiCHENandCursor 4ce8275a8a feat(env): 增加开发/测试/主分支三套独立服务与共享知识库编排及配置
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 15:59:22 +08:00
WeiCHENandCursor 6478742d44 feat(db): 增加共享知识库与隔离系统数据库初始化脚本
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 15:59:19 +08:00
WeiCHENandCursor d27b0ad5ad docs: 建立仓库基础架构、三分支规范与环境运行文档
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-07 15:56:53 +08:00
2897 changed files with 20285 additions and 321366 deletions
-12
View File
@@ -1,12 +0,0 @@
{
"version": 1,
"hooks": {
"beforeShellExecution": [
{
"command": ".cursor/hooks/guard-git.sh",
"matcher": "^git ",
"failClosed": true
}
]
}
}
-60
View File
@@ -1,60 +0,0 @@
#!/usr/bin/env bash
# Fail-closed red-line gate for destructive / unauthorized git. Does not replace agentctl leases.
set -euo pipefail
input=$(cat)
command=$(printf '%s' "$input" | python3 -c 'import json,sys; print(json.load(sys.stdin).get("command") or "")')
ask() {
local user_msg="$1"
local agent_msg="$2"
python3 -c 'import json,sys; print(json.dumps({"permission":"ask","user_message":sys.argv[1],"agent_message":sys.argv[2]}))' "$user_msg" "$agent_msg"
exit 0
}
allow() {
echo '{"permission":"allow"}'
exit 0
}
# Normalize whitespace for matching
cmd=$(printf '%s' "$command" | tr '\n' ' ')
# Unauthorized push (user must confirm)
if printf '%s' "$cmd" | grep -Eq '(^|[[:space:]])git([[:space:]]+-[^[:space:]]+)*[[:space:]]+push([[:space:]]|$)'; then
ask "git push 需要显式用户授权(AGENTS remote_sync)。请确认后再继续。" \
"Hook blocked git push pending user authorization."
fi
# Destructive / force operations
if printf '%s' "$cmd" | grep -Eq 'git[[:space:]]+.*(--force|-f)([[:space:]]|$)' \
|| printf '%s' "$cmd" | grep -Eq 'git[[:space:]]+push[[:space:]].*\+'; then
ask "检测到 git --force / 强推。破坏性操作须用户明确授权。" \
"Hook requires confirmation for force git operation."
fi
if printf '%s' "$cmd" | grep -Eq 'git[[:space:]]+reset[[:space:]]+.*--hard'; then
ask "git reset --hard 会丢弃工作区。须用户明确授权。" \
"Hook requires confirmation for git reset --hard."
fi
if printf '%s' "$cmd" | grep -Eq 'git[[:space:]]+clean[[:space:]]+.*-[a-zA-Z]*f'; then
ask "git clean -f 会删除未跟踪文件。须用户明确授权。" \
"Hook requires confirmation for git clean -f."
fi
if printf '%s' "$cmd" | grep -Eq 'git[[:space:]]+branch[[:space:]]+(-D|--delete[[:space:]]+--force)'; then
ask "强制删分支 (-D) 须用户明确授权;优先 git branch -d。" \
"Hook requires confirmation for git branch -D."
fi
if printf '%s' "$cmd" | grep -Eq 'git[[:space:]]+worktree[[:space:]]+remove[[:space:]]+.*--force'; then
ask "git worktree remove --force 被 AGENTS 禁止升级。须用户明确授权。" \
"Hook requires confirmation for forced worktree remove."
fi
if printf '%s' "$cmd" | grep -Eq 'git[[:space:]]+checkout[[:space:]]+--\.($|[[:space:]])'; then
ask "git checkout -- . 会丢弃全部本地修改。须用户明确授权。" \
"Hook requires confirmation for discarding all local changes."
fi
allow
-17
View File
@@ -1,17 +0,0 @@
{
"mcpServers": {
"agentctl": {
"command": "node",
"args": ["${workspaceFolder}/scripts/mcp/agentctl-mcp.mjs"]
},
"jev": {
"command": "node",
"args": ["${workspaceFolder}/scripts/mcp/jev-mcp.mjs"]
},
"codegraph": {
"type": "stdio",
"command": "codegraph",
"args": ["serve", "--mcp", "--path", "${workspaceFolder}"]
}
}
}
+21 -2
View File
@@ -1,6 +1,25 @@
---
description: 任务分级、授权、文档与收口入口
description: 强制 Agent 文档同步与 ops 协作纪律;详情见 AGENTS.md
alwaysApply: true
---
遵循 [AGENTS](../../AGENTS.md) 的启动、任务分级与收口规则。写入文档前读 [文档地图](../../.doc/README.md);创建、集成、环境操作、清理前读 [操作规范](../../.doc/ops/2026-09-21-agent-worktree-workflow.md)。
# Agent 文档同步(强制)
完整规范见 [AGENTS.md](../../AGENTS.md) 与 [PROJECT.md](../../PROJECT.md)。
## 开场必读
1. `AGENTS.md` → `PROJECT.md` → `.doc/README.md` → `.doc/ops/CURRENT.md` → `FEATURE-MATRIX` → short-term / handoff
## 红线
- 任务开始前:short-term/long-term + CURRENT 并行认领(mutex)
- 合 dev + 容器测:占用 CURRENT 集成槽位;他人 queue 等待
- 多 Agent 并行:worktree(`.worktrees/`);禁止 worktree 内 env-service start
- 禁止只改代码;done 任务 → `archive/ops/`
- 验收报告 → `.doc/test-reports/`;运行产物 → `test-reports/assets/`
- 禁止在 `.doc/` 根或 `docs/` 随意新建文档
## 状态
`planned | in_progress | blocked | done | cancelled`
-23
View File
@@ -1,23 +0,0 @@
---
description: Agent-System 写操作必须经 agentctl(租约、docs apply、候选合入);禁止绕过治理直接改共享文档或 push。
alwaysApply: true
---
# agentctl 强制治理
本仓库由 agentctl 管理面协调(SQLite + launchd daemon)。细则见 [AGENTS.md](../../AGENTS.md) 与 [操作规范](../../.doc/ops/2026-09-21-agent-worktree-workflow.md);流程技能见 `.cursor/skills/agentctl-*`。
## 硬边界
1. **写仓库**:必须 `agentctl with` / MCP `lease_run`。裸 `git commit` 会被 agentctl pre-commit hook 拒绝。
2. **共享文档**:`.doc/ops/CURRENT.md`、`.doc/status/FEATURE-MATRIX.md` 只能 `docs apply`(行级 CAS;MATRIX 键为 `record_id`)。
3. **合入 local dev**:`validate` 后 `queue enqueue`(daemon `--ff-only`)或受控 `integrate`;禁止直接改主目录 `dev` tip。
4. **禁止默认**:未授权 `git push`、晋升 test/main、`--force` 清理、卸载 launchd coordinator、改 gap-matrix / 升 MATRIX 状态值冒充发布。
## 会话路径
- 启动 → skill `agentctl-session-start`
- 建场 → `agentctl-worktree-setup`
- 写回 → `agentctl-lease-write`
- 合入/收口 → `agentctl-integrate-closeout`
- MCP 工具定义见 `.cursor/mcp.json` → `scripts/mcp/agentctl-mcp.mjs`
+20 -2
View File
@@ -1,6 +1,24 @@
---
description: 凭证与推送授权入口
description: Git push 凭证自主读取;禁止向用户索要 token;详情见 AGENTS.md §8
alwaysApply: true
---
遵循 [AGENTS 安全与证据](../../AGENTS.md#5-安全与证据);授权推送的凭证和脚本入口见 [PROJECT](../../PROJECT.md#凭证与推送)。
# Git Secrets 自主(禁止索要)
完整规范见 [AGENTS.md](../../AGENTS.md) §8 与 [PROJECT.md](../../PROJECT.md) §7。
## 本仓约定
- 凭证:`${HOME}/.secrets/gitea`
- 字段:`- ACCESS_TOKEN=`、`- URL_PREFIX=`
- 推送:优先 `./scripts/git-push-dev.sh <branch>`
## 禁止
- 向用户索要或要求粘贴 token
- 在聊天/文档/commit 中展示 secret
- 写入 git config 或提交到仓库
## 缺失时
在 `.doc/ops` 记 blocker(路径 + 缺字段),提示用户本机补齐后重试;**仍不索要内容**。
@@ -1,6 +1,60 @@
---
description: 分支、原子提交与环境操作入口
description: 项目固定3分支模型(dev/test/main)、逐步渐进式提交规范与三套独立服务(知识库共享+对话与DB隔离)准则
alwaysApply: true
---
分支/原子提交边界见 [AGENTS](../../AGENTS.md),环境拓扑见 [PROJECT](../../PROJECT.md)。创建、集成、环境写操作及清理按 [操作规范](../../.doc/ops/2026-09-21-agent-worktree-workflow.md) 执行。
# Git 三分支流转与三套服务环境架构准则
本仓库严格遵循以下固定分支体系、提交拆分规范与多套独立服务运行准则:
## 一、 Git 固定三分支体系
1. **开发分支 (`dev`)**:
- **合入基线**,不是日常 commit 目标。
- **禁止**在 `dev` 上直接开发提交(含 docs/chore)。
- 一律从最新 `dev` 检出 `feature/<name>` 或 `fix/<name>`,在 feature 分支上渐进式提交;自测后占集成槽位,`--no-ff` 合回 `dev`,并删除临时子分支(见 [AGENTS.md](../../AGENTS.md) §6.2)。
2. **测试分支 (`test`)**:
- 当 `dev` 积累了一定的功能阶段后,合并至 `test` 分支,创建阶段候选节点 Tag(如 `rc-vX.Y.Z-beta.1`)。
- 用于较长时间的真实环境部署、全链路集成测试、运维稳定性检验。
- **严禁**在 `test` 分支进行开发或直接 commit。
3. **主分支 (`main`)**:
- 生产发布分支(Release)。
- **严禁**直接在 `main` 上开发或 commit!
- 只有 `test` 分支的代码经过实际运维和测试充分验证达到发布标准后,方可将对应验证节点合并回 `main` 分支,并打正式发布 Tag(如 `v1.0.0`)。
---
## 二、 任务拆分与渐进式提交规范 (Progressive Commits)
- **原子性拆分**:严禁把整个任务的大量改动揉合成一次庞大的提交。
- **阶段逐步提交**:一个任务必须按功能逻辑分层逐步提交:
1. `feat(db)` / `refactor(db)`: 数据表、模型、迁移脚本
2. `feat(agent)` / `feat(service)`: 业务逻辑、智能体执行流程
3. `feat(api)`: 接口路由与交互
4. `test(...)`: 单元测试与集成测试用例
5. `docs(...)` / `chore(...)`: 配置、运维脚本与文档同步
- **提交规范**:遵循 Conventional Commits (`feat`, `fix`, `refactor`, `test`, `docs`, `chore`, `ci`)。
---
## 三、 三套环境独立运行准则 (知识库共享 + 对话与DB隔离)
三套独立服务对应三个分支的运行态:
| 环境 | 分支 | Compose 项目 | HTTP 端口 | DB 端口 | 数据/对话路径 |
| :--- | :--- | :--- | :--- | :--- | :--- |
| **共享知识库** | 跨环境 | `agent-infra` | - | `5432` | `data/shared/kb` |
| **开发环境** | `dev` | `agent-dev` | `8080` | `5433` | `data/dev` |
| **测试环境** | `test` | `agent-test` | `8081` | `5434` | `data/test` |
| **生产环境** | `main` | `agent-main` | `8000` | `5435` | `data/main` |
### 核心约束:
1. **知识库共享**:
- 三套环境服务均通过共享网络或内网连接同一个知识库数据库(`shuimu-kb-shared:5432`)。
- 知识库法规、向量索引保持全局一致。
2. **对话数据与数据库隔离(红线)**:
- 各环境对话记录(Chat History)、Agent 思考工作区、审计事件及 SQLite/Postgres 业务库必须严格隔离!
- 严禁任何环境读取或写入其他环境的对话数据与业务库。
- 宿主机挂载目录严格区分:`data/dev/`、`data/test/`、`data/main/`。
-2
View File
@@ -8,8 +8,6 @@ alwaysApply: true
本仓库严格遵循标准化、可追溯的质量测试管理体系。所有测试报告必须归档于指定的文档目录下,并遵循固定结构。
**范围判定**:纯工程规范/文档变更按 [PROJECT.md](../../PROJECT.md) §8 和 [worktree 工作规范](../../.doc/ops/2026-09-21-agent-worktree-workflow.md) 检查链接、规则一致性及 Git 差异;不适用下述产品 PI 全链路与全量 Go 回归要求。报告注明 NOT REQUIRED 及依据,不能记成产品测试 PASS。运行模板、提示词和业务变更不属于此例外。
## 一、 测试报告归档路径规范
- **统一目录**:所有测试报告必须统一存放于 `.doc/test-reports/` 目录下。
@@ -1,62 +0,0 @@
---
name: agentctl-integrate-closeout
description: Validate a merge candidate, enqueue for daemon ff-only integrate, and close out five-state. Use when ready to land a task on local dev.
---
# agentctl 集成与收口
权威:[操作规范](../../../.doc/ops/2026-09-21-agent-worktree-workflow.md)、[验证契约](../../../.doc/ops/2026-09-21-validation-contract.md)。常驻 daemon 已装载时走 **enqueue**,勿手动 `integrate`(除非 daemon 停)。
## 候选
```bash
D=$(git -C /path/to/Agent-System rev-parse HEAD) # 冻结 expected-dev
ID=integrate-<task>-YYYY-MM-DD
git worktree add -b feature/$ID .worktrees/$ID "$D"
cd .worktrees/$ID
python3 ../../scripts/agentctl.py task register --id "$ID" --owner Cursor --scope . --capability git:dev
python3 ../../scripts/agentctl.py with --task "$ID" \
--resource path:. --resource git:index --resource git:dev -- bash -lc '
git merge --no-ff -m "merge: candidate <feature> into dev" feature/<task>
'
```
第一父必须等于 `$D`。
## validate → enqueue(daemon ff)
```bash
python3 ../../scripts/agentctl.py validate --task "$ID" -- <验收命令>
python3 ../../scripts/agentctl.py queue enqueue \
--task "$ID" --expected-dev "$D" --head "$(git rev-parse HEAD)"
# 在任务 worktree 内 enqueue;数秒内 daemon 合入
python3 ../../scripts/agentctl.py queue list
python3 ../../scripts/agentctl.py daemon status
```
验收按验证契约选行;治理脚本用 `unittest discover`。
## 五态收口
| 字段 | 典型值 |
|---|---|
| review_state | accepted |
| integration_state | merged_local_dev |
| deployment | not_required 或 loaded_local_launchd |
| cleanup | pending(独立维护者;禁止 `--force`) |
| remote_sync | not_requested |
CURRENT 行 → `done`(`docs apply`);`task close --status done`。
## 清理前
确认 tip 为 local_dev 祖先、证据已持久化、无 tracked/untracked 遗留、无进程占用。唯一日志/对话归档进 `.doc/ops/evidence/` 后再 `worktree remove`。
只读盘点(不自动删除、不自动写 MATRIX):
```bash
python3 ../../scripts/agentctl.py cleanup report # 主目录或任意同仓 cwd
python3 ../../scripts/agentctl.py docs drift
```
对 `verdict=ready` 的 worktree 由独立维护者执行 `agent-worktree.sh remove … --delete-branch`;拒绝则保留 cleanup_pending。daemon 未装载时用 `queue schedule --drain`(主目录 + 分支 dev)。
@@ -1,46 +0,0 @@
---
name: agentctl-lease-write
description: Write under agentctl leases and docs apply CAS. Use before any git write, shared-doc edit, or when hitting UNMANAGED_DOCUMENT_CHANGE / EVIDENCE_REQUIRED.
---
# agentctl 租约写回
权威:[AGENTS §3–5](../../../AGENTS.md)、[操作规范](../../../.doc/ops/2026-09-21-agent-worktree-workflow.md)。
## 原则
- **任何仓库写**(含 `git add/commit`)必须在 `agentctl with` / MCP `lease_run` 租约内
- CURRENT / FEATURE-MATRIX **只能** `docs apply`(行级 CAS;MATRIX 键为 `record_id`)
- 直接 `git commit` 会被 agentctl-managed pre-commit hook 拒绝
## lease_run(CLI)
```bash
python3 scripts/agentctl.py with \
--task "$ID" \
--resource path:scripts --resource path:.doc --resource git:index \
-- bash -lc 'git add … && git commit -m "…"'
```
MCP:`lease_run` 的 `command` 为 **argv 数组**(无额外 shell)。
## docs apply(行级)
```bash
python3 scripts/agentctl.py docs snapshot --file .doc/ops/CURRENT.md --record "$RID"
# expected_sha256 = snapshot.sha256;改 replacement 后:
python3 scripts/agentctl.py docs apply --task "$ID" --request /tmp/req.json
```
FEATURE-MATRIX 升 `done` 需要 `docs:approve` + 可核验 evidence(`git cat-file -e`),否则 `EVIDENCE_REQUIRED`。
收口或合入含 MATRIX 的变更后跑 `python3 scripts/agentctl.py docs drift`:硬告警仅 `done→非 done`;不因任务结束自动升 done。
## 常见拒绝
| 码 | 处置 |
|---|---|
| `UNMANAGED_DOCUMENT_CHANGE` | 保留现场,先 snapshot/reconcile,勿覆盖 |
| `BASE_CHANGED` | 重新 snapshot,基于新 sha 再 apply |
| `AMBIGUOUS_RECORD` | 修重复 record_id / 模块名 |
| `CAPABILITY_REQUIRED` | 任务缺 docs:admin / docs:approve |
| `DOCUMENT_RECEIPT_REQUIRED` | 共享文档须经 apply 收据后再 commit |
@@ -1,39 +0,0 @@
---
name: agentctl-session-start
description: Start an Agent-System session under agentctl governance. Use at session start, when opening a worktree, or before any write to this repo.
---
# agentctl 会话启动
权威规范:[AGENTS.md](../../../AGENTS.md)、[操作规范](../../../.doc/ops/2026-09-21-agent-worktree-workflow.md)、[CURRENT](../../../.doc/ops/CURRENT.md)。
## 步骤
1. 读 `AGENTS.md`、`PROJECT.md`、`.doc/ops/CURRENT.md` 活跃摘要(勿跳过)。
2. 核对管理面:
```bash
python3 scripts/agentctl.py daemon status
# 期望:status=ok;launchd 已装载时 manager.lock.held=true
```
或 MCP 工具 `status`。
3. 刷新 CodeGraph 索引(fail-open;CLI 缺失可跳过):
```bash
codegraph sync -q
# 或:python3 scripts/agentctl.py hooks codegraph-sync
```
跨文件定位优先用 CodeGraph MCP/`explore`;**grep 仍是完整性唯一权威**(假阴性时以 grep 为准)。
4. 若任务已存在:在注册 worktree 内工作,确认 `tasks.state=active`。
5. 若新任务:跟 [agentctl-worktree-setup](../agentctl-worktree-setup/SKILL.md)。
6. 任何仓库写 → [agentctl-lease-write](../agentctl-lease-write/SKILL.md);合入 → [agentctl-integrate-closeout](../agentctl-integrate-closeout/SKILL.md)。
## 禁止
- 主目录直接开发提交;未授权 `git push` / 晋升 test/main
- 绕过 `docs apply` 改 CURRENT / FEATURE-MATRIX
- 卸载或重启 launchd coordinator(除非用户明示)
@@ -1,52 +0,0 @@
---
name: agentctl-worktree-setup
description: Create an agentctl task worktree, register scopes/capabilities, and claim CURRENT. Use when starting a new feature/fix task in Agent-System.
---
# agentctl 建场
权威:[操作规范](../../../.doc/ops/2026-09-21-agent-worktree-workflow.md)。
## 命令序列
```bash
cd /path/to/Agent-System # 主目录(dev)
D=$(git rev-parse HEAD)
ID=<task-id-YYYY-MM-DD>
WT=.worktrees/$ID
# 推荐入口:自动 best-effort codegraph init(后台;CLI 缺失不阻断)
./scripts/agent-worktree.sh create feature/$ID
# 等价:git worktree add -b feature/$ID "$WT" "$D"
cd "$WT"
python3 ../../scripts/agentctl.py task register \
--id "$ID" --owner <Owner> \
--scope scripts --scope .doc \
--capability docs:publish
# 需要整文/行级 admin 时再加 --capability docs:admin;证据升 done 加 docs:approve
codegraph sync -q # 若建场已 init,此处只需 sync;缺失 CLI 可跳过
```
## CURRENT 认领(docs apply)
```bash
python3 ../../scripts/agentctl.py docs snapshot \
--file .doc/ops/CURRENT.md --record "$ID" > /tmp/claim-snap.json
# 新建行:expected_sha256=null
cat > /tmp/claim.json <<EOF
{"request_id":"$ID-claim-1","changes":[{
"file":".doc/ops/CURRENT.md","record_id":"$ID","expected_sha256":null,
"replacement":"| <Owner> | $ID | feature/$ID | $WT | <mutex> | in_progress |"
}]}
EOF
python3 ../../scripts/agentctl.py docs apply --task "$ID" --request /tmp/claim.json
```
## short-term 模板字段
`status`、`write_scope`、`mutex`、`base_dev_sha`、`review_state`/`integration_state`/`deployment`/`cleanup`/`remote_sync`。命名 `.doc/ops/short-term/YYYY-MM-DD-<slug>.md`。
## 注意
- 从确切 `dev` SHA 创建,不从他人 feature 分支启动
- 重叠 path/mutex 只允许一个写者
- CodeGraph 索引是加速器:有假阴性;穷举调用方仍用 grep
-52
View File
@@ -1,52 +0,0 @@
---
name: jev-decide
description: Use jev-service typed decisions (choice/noul/numeric with probabilities) for Agent-System governance classification. Use when choosing task tier, validation level, reject-code routing, or other closed-enum judgments.
---
# jev-decide(治理决策)
依赖 MCP 服务器 `jev`([`scripts/mcp/jev-mcp.mjs`](../../../scripts/mcp/jev-mcp.mjs))。凭证在本机 `~/.secrets/jev/`(`api.key`、`base-url`),**禁止**写入仓库、commit 或聊天。
## 何时用
输入是情境文本、输出是**封闭枚举 / yes-no / 分桶数值**时调用 `jev_decide`,例如:
| 决策点 | 建议 questions |
|---|---|
| 任务分级(是否开 worktree) | `choice`:`info_reply` / `single_task` / `cross_module` |
| 验证层级(验证契约) | `choice`(可多题):`doc` / `script` / `go` / `frontend` / `migration` / `product_pi` |
| 拒绝码处置 | `choice`:`reconcile` / `re_snapshot` / `fix_record_id` / `request_capability` / `abort` |
| 是否 blocker / 是否触碰重验面 | `noul` |
不适合:需要解释链、多步规划、自由文本生成——那些走大模型或 agentctl 确定性门禁。
## 调用约定
1. 可选先 `jev_health`;失败则本机判断,勿阻塞写路径。
2. `jev_decide`:同一情境的多问合成一次请求。
3. 问句**正向措辞**,避免双重否定。
4. 置信度路由:
- `confidence >= 0.9` 且 top1−top2 ≥ 0.15 → 可采用
- 否则 → agent 自行按规范裁定,把 jev 结果当参考
5. 401/超时/`answers.*.error` → 降级到本机判断;勿把决策失败变成业务失败。
## 示例(任务分级)
```json
{
"context": "用户请求:给 CURRENT 加一行认领说明,不改代码",
"questions": {
"tier": {
"type": "choice",
"question": "This request matches which AGENTS task tier?",
"options": ["info_reply", "single_task", "cross_module"]
},
"needs_worktree": {
"type": "noul",
"question": "Does this require a new feature/fix worktree?"
}
}
}
```
权威矩阵仍以 [AGENTS.md](../../../AGENTS.md)、[验证契约](../../../.doc/ops/2026-09-21-validation-contract.md) 为准;jev 只加速封闭枚举分类,不替代机器门禁(admit/hooks/docs apply)。
+3 -14
View File
@@ -11,10 +11,10 @@
.doc/
README.md ← 本文件(总地图)
status/ ← 模块/功能完成度 SSOT
audit/ ← 问题发现与分析、ISSUES.md 问题/修复台账
audit/ ← 问题发现与分析
remediation/ ← 整改方案与发布缺口
archive/ ← 历史(只增不删)
ops/ ← 活协作(任务、交接、调研;lessons/ 开发经验)
ops/ ← 活协作(任务、交接、调研)
system-design/ ← 模块架构深读
adr/ ← 架构决策
backlog/ ← 产品 backlog(非阻塞)
@@ -33,22 +33,15 @@
| 我要… | 读这里 |
|--------|--------|
| 规则来源/生效版本 | [规范登记](ops/2026-09-21-policy-registry.md) |
| 选择测试/报告范围 | [验证契约](ops/2026-09-21-validation-contract.md) |
| 任务模板与会话收口 | [任务模板](ops/templates/short-term-task.md) · [收口清单](ops/templates/session-close-checklist.md) |
| 创建任务、集成、部署、清理 | [worktree 工作规范](ops/2026-09-21-agent-worktree-workflow.md) |
| 当前在做什么 | [ops/CURRENT.md](ops/CURRENT.md) |
| 模块完成度 | [status/FEATURE-MATRIX.md](status/FEATURE-MATRIX.md) |
| 发布 blocker | [remediation/gap-matrix.md](remediation/gap-matrix.md) |
| 问题历史、修复经过 | [问题台账](audit/ISSUES.md) · [闭环规范](ops/2026-09-23-issue-learning-workflow.md) |
| 开发注意事项与经验检索 | [经验索引](ops/lessons/INDEX.md) |
| 审计/问题分析 | [audit/INDEX.md](audit/INDEX.md) |
| 整改方案 | [remediation/INDEX.md](remediation/INDEX.md) |
| 历史归档 | [archive/README.md](archive/README.md) |
| 架构设计 | [system-design/README.md](system-design/README.md) |
| 测试报告 | [test-reports/](test-reports/) |
| 历史功能设计 | [archive/design/superpowers/](archive/design/superpowers/) |
| Herdr 角色、审批与备援 | [ops/2026-09-13-herdr-agent-roster.md](ops/2026-09-13-herdr-agent-roster.md) |
---
@@ -63,13 +56,9 @@
## 文档生命周期
按 [AGENTS 任务分级](../AGENTS.md#2-任务分级与授权) 选择最小产物。下图是可选信息流,不要求每任务创建所有文件;小任务/有价值的只读审查可由一个主文档承载范围、结论、验证与交接。主文档先明确 task_id、owner、授权来源、状态和证据;跨阶段信息确需独立时才拆分并回链。
```text
audit(问题)→ remediation(方案)→ ops/short-term(任务)
→ test-reports(验收)→ archive(关闭证据)
```
任务状态字段:`planned | in_progress | blocked | done | cancelled`。问题以 issue_state、经验以 lesson_state 独立记录,取值与转换见 [闭环规范](ops/2026-09-23-issue-learning-workflow.md);研究任务完成不关闭待修问题。
会话结束不等于任务完成;只有 done/cancelled 任务归档。CURRENT 保留最多 3 项焦点及活跃/阻塞/待集成/待清理事项,完成认领和长证据迁入 [历史快照](archive/ops/2026-09-21-current-history.md)。移动文档同步修复相对链接,保留证据与来源。规范生命周期另用 proposed/approved/active/deprecated;工具能力另用 manual/enforced。
状态字段:`planned | in_progress | blocked | done | cancelled`
@@ -1,25 +0,0 @@
# ADR:文档 Version / Revision 边界与决策门
## 状态
已接受(2026-09-13,用户确认 DOCREV 整改实施计划)
## 背景
受控文档此前只有当前 `output.md` 与 SHA,无法表达「智能体基线 + 后续人工修改」的业务版本语义;自由文档每次保存 +1 的 `current_version_id` 与本需求冲突。
## 决策
1. **版本边界**:模板或一次成功提交的智能体/智能体小队产物开启 `Version`;人工每次服务端成功保存只增加该 Version 内的 `Revision`,不增加面向用户的版本号。
2. **high/critical 候选**:风险达到 `high` 或 `critical` 的 agent candidate,必须经编制负责人二次确认后才能 `CommitAgentVersion`。
3. **首发范围**:Wave 1–5 仅覆盖受控文档;自由文档统一读模型与 UI 语义切换放在 Wave 6。
4. **根表指针列**:统一 `ledger_*` / `head_*` 前缀;禁止与 `freeform_documents.current_version_id`(00008 每-save+1 legacy)同名承载新语义;旧列迁移时改名为 `legacy_version_id`。
5. **Goose**:从 **00028** 起递增;不得硬占用并行分支可能冲突的旧号。
6. **保留策略**:受控文档随项目/法规保留;自由文档默认 365 天可配置,禁止静默硬删。
7. **发布 blocker**:方案评审与 Wave 落地阶段不擅自写入 gap-matrix;纳入发布范围后再新增行。
## 后果
- 实施必须按 Wave 0→6 顺序;禁止先上前端颜色标记再补快照事实源。
- `document_records.version` / `content_sha256` 在兼容期由 ledger 同事务投影,稳定后退役。
- 详细表结构、API、状态机见 [../system-design/document-revision-management.md](../system-design/document-revision-management.md)。
@@ -1,25 +0,0 @@
# ADR:最终成果保险库(FAV)
## 状态
已接受(2026-09-14,落地计划 V0–V6)
## 背景
运行库 PostgreSQL 与 workspace 投影会一起丢失或错挂。需要独立保存**已确认终态**的精确字节,但不能成为第三套完整业务真相源,也不能用目录扫描猜测“最终文件”。
## 决策
1. **三层权威**:PostgreSQL 管项目/权限/工作流/版本关系;workspace 是可清理投影;FAV 只对已归档 payload、manifest、来源证据和删除状态权威。
2. **无 tenant_id**:安全边界沿用 `environment + project_members + role-admin`。未来组织层另立 ADR。
3. **事件准入**:只接受方案准入表中的数据库事实。显式 publish/pin 不能绕过终态 allowlist。禁止扫描 workspace。
4. **同事务冻结**:终态事务把精确 payload/SHA 写入 staging 并写 unpublished outbox;publisher 不得重读可变消息行。
5. **union-deny 删除**:运行库删除账本或 vault tombstone 任一侧删除即拒绝读取/恢复。
6. **恢复**:只进 scratch 库,默认 `recover-as-collection`。禁止 GET 自动写回或覆盖现有 head。
7. **互补**:FAV、migration corpus、完整 DB backup/PITR 互相不能替代。不作为 409/split-brain 绕行。
## 后果
- 实现从 `feature/final-artifact-vault` 推进;mutex=`artifact-vault`。
- Goose 从 **00034** 增加 FAV 表(00033 已被 task-run 治理占用)。
- 降级读取默认关闭(`FAV_DEGRADED_READ`),Unit A 纠挂完成前不得对现网开启。
@@ -1,62 +0,0 @@
# ADR:以纵向绞杀方式实施模块化单体解耦
## 状态
已接受(2026-09-14 提议;2026-09-18 确认——Phase 1 纵向绞杀与 Phase 2 持久事件交付已落地并验收,见 gap-matrix `DOC-RELIABILITY-PILOT` PASS、[Phase 1 计划](../remediation/2026-09-14-module-decoupling-refactor-plan.md)、[Phase 2 修订计划](../remediation/2026-09-15-module-decoupling-ipc-phase2-remediation-plan.md)、[Track E 复盘](../ops/research/2026-09-15-track-e-retrospective.md))
## 背景
`internal/server`、`internal/bizdev`、共享 `UserProjectContext`、工作区路径和多表写入形成隐式耦合。
历史受控正文 404/409、刷新后投影缺失和任务终态不完整说明,单纯搬包不会修复事实源、事务与恢复边界。
## 决策
1. **保持模块化单体**:不拆微服务;进程内调用使用窄端口,跨进程可靠性只用于持久事件和 FAV。
2. **纵向绞杀**:先在现有包边界插入端口和适配器,迁完一条业务链并验证后再移动或重命名包;禁止“先全量搬包、以后再接口化”。
3. **契约分层**:外部 API DTO 归 `server/api`;持久 schema、公共事件和稳定共享词汇进入按领域划分的 contracts;一对一内部接口由消费者拥有。
4. **命令与事务同属一个应用用例**:一个业务命令只有一个事务 owner;跨表属主通过同一不透明事务作用域协作,业务状态、账本、当前指针、staging 和 outbox 原子提交。
5. **单一写者不等于单独事务**:表属主控制 SQL 和不变量;应用 UnitOfWork 控制跨属主提交边界。属主端口不得私自嵌套提交。
6. **并发正确性以数据库为准**:用户编辑使用乐观版本/ETag;状态转换使用行锁和条件更新;项目级不变量可使用事务级 advisory lock;进程内 mutex 只能优化,不能作为多副本正确性依据。
7. **锁顺序固定**:同一事务按 project/workflow instance → document record → document version/snapshot → task run → outbox/staging 的顺序取锁;事务内禁止 LLM、对象存储、网络调用和长文件 I/O。
8. **可靠事件采用 transactional outbox**:事件按至少一次投递设计,具有稳定 ID、schema version、环境/项目范围、聚合序号、因果链和幂等键;逐消费者记录 delivery、重试、租约和死信。
9. **工作区是可清理投影**:跨模块只传不可伪造 Workspace ID 和受限 artifact key;物理路径只在 workspace/squadrun 适配器内解析和校验。
10. **最终成果进入 FAV**:PostgreSQL 保存业务关系和授权,FAV 只保存已确认终态的精确 payload、manifest、回执和删除状态,workspace 不承担最终成果事实源。
11. **授权逐动作校验**:认证适配器构造不可由请求覆盖的 Principal;HTTP、CLI、后台订阅者和恢复流程都按 action/resource/current state fail closed。
12. **先完成文档可靠性试点**:只有受控正文刷新、重启、并发提交、投影缺失降级和授权负例通过后,才批准 chat、squad、编排层和传输层扩展。
13. **迁移采用 expand/migrate/contract**:允许新增 Goose migration;不得修改已发布迁移;回滚只保证回到最近的兼容阶段,不能任意独立 revert 早期依赖。
14. **协议改造独立立项**:统一错误信封和 PI Runner `result.json` 不作为核心模块解耦前置条件;它们使用独立兼容与 E2E 验收。
## 并发与失败语义
- 普通聚合状态转换默认 `READ COMMITTED` + 明确行锁/条件更新;涉及跨聚合唯一不变量时才使用 Serializable,并对 `40001`/`40P01` 重跑完整事务。
- outbox worker 使用小批次 `FOR UPDATE SKIP LOCKED` 认领,处理发生在事务外;完成、续租和失败回填使用 fencing token 防止过期 worker 覆盖新 owner。
- 每个写命令必须同时有 idempotency key、expected version 或两者;相同 key 不同 payload 返回 typed conflict。
- 锁等待、事务时长、重试次数、队列积压和死信必须可观测;超过预算时失败返回,不无限等待。
## 授权与恢复语义
- Principal 至少携带 actor、环境、认证来源和请求关联 ID;项目、会话、文档、阶段与 duty 从数据库权威关系重新解析。
- 持久事件中的 actor 只用于审计,不能替代订阅者对当前资源状态的授权检查。
- FAV 降级读取要求运行库授权图完整;授权图缺失时禁止面向用户返回内容。
- 恢复只允许进入 scratch identity;promotion 需要系统管理员与数据责任人确认,并通过各属主端口提交,禁止恢复 CLI 直写运行表。
## 后果
- 首个实现里程碑的改动面小于原 Wave 1–6,但会先增加 UnitOfWork、事件投递和授权基础设施。
- “单表唯一写者”检查改为生产 SQL 写权限检查,并允许 migration、测试和经批准运维脚本存在表名。
- `feature/final-artifact-vault` 是候选依赖,不直接假定可合入;必须先按当前 dev 重放测试、迁移和权限审计。
- 包物理移动、错误信封、SSE 和 PI Runner 协议可延后,不阻塞文档一致性整改。
## 替代方案
- **一次性横向搬包**:拒绝。冲突面大,不能先证明用户故障减少。
- **仅增加 arch-check**:拒绝。门禁不能替代事务、锁和授权契约。
- **拆微服务**:拒绝。当前问题是模块边界和数据一致性,不需要引入分布式事务与跨服务部署成本。
- **继续把 workspace 作为恢复来源**:拒绝。工作区属于可清理计算现场,不能成为最终事实源。
## 相关文档
- [模块解耦架构](../system-design/2026-09-14-module-decoupling-architecture.md)
- [模块解耦整改与重构计划](../remediation/2026-09-14-module-decoupling-refactor-plan.md)
- [方案复核](../audit/2026-09-14-module-decoupling-plan-review.md)
- [文档版本边界 ADR](./2026-09-13-document-version-boundary.md)
@@ -1,30 +0,0 @@
---
title: "事件连续性采用 consumer checkpoint + 首事件 bootstrap"
status: accepted
created: 2026-09-15
updated: 2026-09-15
---
# ADR:事件连续性采用 consumer checkpoint + 首事件 bootstrap
## 状态
接受(E0A)。在独立 FAV 审计或明确的无缺口 event sequence 迁移完成前不得改为 gap blocking。
## 背景
`event_envelopes` 已有 `UNIQUE (aggregate_type, aggregate_id, aggregate_version)`。受控文档的首次持久事件常常从较高 `aggregate_version`(账本 version_no)开始,中间版本从未发事件。若把领域版本号当成无缺口事件序号并在缺号时等待,会永久阻塞 delivery。MemoryBus 的 `TestGapDoesNotSkipVersion` 只是 characterization,不得搬到 PostgreSQL dispatcher。
## 决策
1. Track E 选择 **consumer checkpoint + 首事件 bootstrap**。
2. 每个 `(consumer, aggregate_type, aggregate_id)` 记录已成功处理的 `event_id` 与可选 `aggregate_version`。该 aggregate 上的第一件 **safe** 事件即为 bootstrap,不要求 version=1。
3. 同一版本多个不同类型事件:当前唯一约束禁止。E0A 审计后保持该约束;需要同版本多事件时另立 additive 迁移,把序号改到独立 `event_seq`,不在本 ADR 启用。
4. **禁止** 在 dispatcher 启用 gap wait / `ErrGapWait` 阻塞,直到另有 ADR 选择独立无缺口 event sequence 且完成回填。
5. 未知 schema、project 0、错误 environment、未知 consumer 的记录进入 inventory,不得 live claim。
## 后果
- E0B checkpoint 表随 dispatcher migration 增加。
- Projection 以 `document_id + source_snapshot_id + digest` no-replace,不依赖连续 version。
- poison 事件 quarantine 后不静默跳号;其他 aggregate 继续。
@@ -1,85 +0,0 @@
# ADR:纯软件工作流 key 与领域边界(SWBOOT-00)
## 状态
已接受(2026-09-16)
## 背景
工作流引擎已声明 `non_medical_software` 产品域,但正式目录、创建入口与模板仍以医疗器械三工作流(`main` / `product_manager` / `test_manager`)为硬编码白名单。继续复用医疗 manifest 会造成临床/注册/CDO 语义污染;直接改写既有三 key 会破坏已激活医疗实例。
详细设计见 [software-project-bootstrap-workflow](../system-design/2026-09-14-software-project-bootstrap-workflow.md)。
## 决策
### 1. 新增正式可选工作流 key
| key | 定位 | 默认产品域 | 可重复实例 |
|-----|------|------------|------------|
| `software_bootstrap` | 一次性建立项目事实、需求、架构、风险、路线与验证基线 | `non_medical_software` | 否(默认一次;终止后可重建并保留旧证据) |
| `software_delivery` | 按里程碑/发布重复交付,承接 change brief → 证据 → 验证 → 发布 → 复盘 | `non_medical_software` | 是 |
医疗三 key **保持不变**,仍为正式可选;不得在其 published hash 上替换为软件语义。
### 2. 目录策略:published + selectable,而非“仅三 key”
项目可选工作流 = 已发布 (`latest_published_version > 0`) ∩ `project_selectable=true` ∩ 策略白名单。
白名单扩展为:
```text
main | product_manager | test_manager | software_bootstrap | software_delivery
```
固定文档数量校验 **仅** 继续约束医疗三 key;软件工作流按 manifest 自身完整性校验,不强制医疗文档数。
### 3. 领域与合规分离
- `product_domain=non_medical_software` 只说明非医疗器械,不关闭鉴权/审计/安全基线。
- `compliance_profile` / `governance_profile` / `execution_mode` / `team_mode` 为项目级独立字段。
- 首期默认:`governance=standard`,`compliance=internal_control+security_baseline`,`execution_mode=docs_only`。
- `controlled_patch` 在 SWBOOT-10 受控执行器就绪前 **不可真正启用**;仅保留 allowlist stub。
### 4. 串联而非回环
```text
software_bootstrap(完成 + 创建者确认)
→ 仅建议 software_delivery
→ 创建者确认后新建 planning/激活实例
```
bootstrap 完成不得自动创建或激活 delivery。
### 5. Solo 审批策略(契约)
- `collaborative`:独立三权(author/reviewer/approver 不同人)。
- `solo`:`creator_acknowledgement`;页面与审计持续标注“未独立评审”。
- `controlled` 或要求独立审查的 compliance profile:**禁止 solo**。
### 6. 错误码(首期)
| code | 含义 |
|------|------|
| `ERR_WORKFLOW_NOT_SELECTABLE` | key 不在正式可选白名单或未 published |
| `ERR_DOMAIN_INCOMPATIBLE` | 工作流与项目 `product_domain` / `project_type` 不兼容 |
| `ERR_COMPLIANCE_PROFILE` | 合规配置非法或与治理冲突(如 controlled+solo) |
| `ERR_EXECUTION_MODE_DISABLED` | 请求 `controlled_patch` 但受控执行器未启用 |
| `ERR_REPO_PATH_NOT_ALLOWLISTED` | 仓库路径不在管理员 allowlist(SWBOOT-10 stub) |
| `ERR_CREATION_PREVIEW_STALE` | creation token / plan_hash 过期或不匹配(409) |
### 7. 运行时权威不变
继续遵守 [workflow-runtime-authority](./2026-09-12-workflow-runtime-authority.md):任务只能从冻结 `doc_task_instance` 启动;禁止客户端 `task_key`/duty/stage 旁路。
## 后果
- Bootstrap seed 与 catalog API 必须同时暴露软件两 key,且按 `product_domain` 过滤时不把医疗默认话术塞进软件项目。
- 项目表 additive 增加 `project_type_key` / `compliance_profile_key` 等字段;旧项目不自动分类为医疗或软件。
- SWBOOT-10 仅落地 allowlist stub:任何真实 patch/merge/push 必须 fail closed,直到独立 Epic 验收。
- 医疗三工作流黄金用例与固定文档数门禁保持回归基线。
## 关联
- 实施任务:`.doc/ops/short-term/2026-09-16-software-project-bootstrap.md`
- Backlog:`.doc/ops/long-term/2026-09-14-software-project-bootstrap-implementation.md`
- 验收清单:`.doc/ops/checklists/2026-09-14-software-project-bootstrap-acceptance.md`
@@ -1,63 +0,0 @@
---
title: "D7 对话数据留存与删除口径(草案)"
status: proposed
created: 2026-09-17
updated: 2026-09-17
compliance: pending-compliance-signoff
owner: Cline
related:
- ../remediation/2026-09-16-partial-deferred-completion-plan.md
- ../ops/short-term/2026-09-16-partial-deferred-completion.md
- ../status/FEATURE-MATRIX.md
---
# ADR:D7 对话数据留存与删除口径
## 状态
**提议 / 工程草案**(2026-09-17)。数字与删除口径标 `pending-compliance-signoff`:合规签字或改数前,W7 仅允许数据分类盘点与现状审计,不得按未签字数字执行物理删除或备份清除。接受后状态改为 `accepted`。
## 背景
FEATURE-MATRIX「对话数据治理(D7)」为 `deferred`。收口计划 W7 要求:数据分类盘点 → 留存/删除口径落 ADR → 库/备份/日志控制 → 敏感字段加密边界。工程不能单方面定合规数字,但必须提供可审草案,避免无限期停在 deferred。Track E / R13 / R18 / R22 已对日志脱敏与销毁门禁有硬约束,本 ADR 将其固化为 D7 口径。
## 决策(建议默认;待合规确认)
### 1. 数据分类与留存
| 数据类 | 留存 | 说明 |
|--------|------|------|
| 会话正文(chat sessions/messages) | 热库 **365 天**(可配置) | 超期 soft-delete → 观察窗 → 物理清理 |
| 派生文档 / 私密文档 | 与聊天**独立周期**;回收站 **30 天**后物理清理 | 删除 UI 须说明影响范围(只删聊天 / 只删文档 / 两者) |
| 审计元数据(导出/治理审计) | **180 天** | 不可被普通用户删除覆盖 |
| Agent trace / workspace 非终态 | 任务结束后 **30 天**;nightly 仅合成数据 | 禁止当长期事实源 |
| 日志 / dead-letter / reconciliation | 不按正文留存;**只存 ID、digest、typed error code、allowlist 摘要** | Track E 红线 |
| FAV 终态制品 | `retention_class` + legal hold + delete ledger | 与聊天口径解耦 |
### 2. 删除路径
1. **用户删除**:soft-delete / tombstone → 观察窗 → 物理清理。
2. **备份清除**:须二次批准 + 精确 delete manifest;对齐销毁门禁 R22(完整备份恢复演练、migration corpus、FAV coverage、manifest、用户批准)。
3. **删除界面**:必须说明聊天源消息与派生文档的独立保留周期及本次操作影响范围。
### 3. 加密边界(首期)
- 首期范围:敏感字段**盘点** + 传输与备份访问控制。
- **不默认**上字段级加密;选型待合规确认与威胁模型后再立实现任务。
### 4. 违规升级
盘点确认当前基线违反已确认的安全或合规要求 → **立即**写入 [`gap-matrix.md`](../remediation/gap-matrix.md),不得继续当普通 backlog;本行 `done` 让位于整改。
## 后果
- W7 可按本草案启动盘点;物理删除与备份清除在 `pending-compliance-signoff` 解除前禁止按建议数字自动执行。
- 2026-09-17 只读盘点:[../audit/2026-09-17-d7-data-inventory.md](../audit/2026-09-17-d7-data-inventory.md)(未删数据、未升矩阵 done、未写 gap-matrix blocker)。
- 日志/DLQ/reconciliation 实现与审计须持续满足 Track E ID-only 红线。
- 合规改数后:更新本 ADR 数字表、`updated` 日期,并将 `compliance` 改为 `signed` / `accepted`;再开 W7 整改实现。
## 相关链接
- 收口计划 §7.1:[../remediation/2026-09-16-partial-deferred-completion-plan.md](../remediation/2026-09-16-partial-deferred-completion-plan.md)
- FEATURE-MATRIX D7 行:[../status/FEATURE-MATRIX.md](../status/FEATURE-MATRIX.md)
- Track E Phase 2:[../remediation/2026-09-15-module-decoupling-ipc-phase2-remediation-plan.md](../remediation/2026-09-15-module-decoupling-ipc-phase2-remediation-plan.md)
@@ -1,609 +0,0 @@
---
title: "个人工程中控台:实时项目看板与离线 HTML 快照"
type: feat
date: 2026-09-17
artifact_contract: ce-unified-plan/v1
product_contract_source: ce-plan-bootstrap
execution: code
---
> **已废弃(2026-09-17;2026-09-19 更新)**:旧版只读工程中控台代码已移除。后来短暂合入的 Control Center 也已移出本仓库,进度管理由独立项目承担。本文仅作历史证据保留。
# 个人工程中控台:实时项目看板与离线 HTML 快照
## Goal Capsule
为仓库所有者提供一个独立于产品后台的本地只读中控台。打开一个页面即可判断当前系统由什么组成、哪些任务正在计划或实施、真实分支和 worktree 在哪里、各环境实际运行了什么,并能在两次点击内到达对应的设计、审计、整改、任务和测试材料。
中控台同时提供两种输出:
1. `serve`:持续采集本地仓库、Git 和运行环境,提供自动刷新的 HTML 页面与机器可读 JSON;
2. `export`:基于同一份不可变快照生成单文件 HTML,便于归档、离线查看和交接。
这不是产品功能,不接入产品后台、产品数据库或产品权限体系;它也不是发布系统,不执行 Git、Docker、部署或文档写操作。
### 成功标准
- 在当前仓库规模下,首次可用页面目标为 2 秒内出现;慢数据源可随后标记为 `degraded`,不得拖垮整页。
- 正常情况下,本地文件、Git 或运行态变化在 5 秒内反映到新快照。
- 页面分别展示“文档声明、Git 实施、验证证据、环境实装”,不把任务文档的 `done` 翻译为已合并或已部署。
- 每个关键结论均显示来源、采集时间、新鲜度和可信类型;冲突保留双方证据,不静默选边。
- 在线模式检索 allowlist 内未截断的 Markdown 正文;离线导出同时给出 included、truncated 和 metadata-only 清单,二进制附件只索引路径、类型、大小和归属。
- 单文件 HTML 默认权限为 `0600`,可脱离仓库阅读已纳入 inclusion manifest 的 Markdown 正文,并醒目标出截断或仅元数据条目;不打包 `.doc/**/assets`。
- 任一采集源失败时仍可查看最近成功数据,并明确显示 `stale/error/last_success_at`。
---
## Product Contract
### 用户与使用场景
唯一主要用户是仓库所有者。典型使用包括:
- 每天开始工作时查看焦点任务、阻塞、集成槽和环境异常;
- 从模块进入设计、任务、测试和部署证据链;
- 判断某项工作究竟只是有计划、正在实现、已经验证,还是已在某环境实装;
- 查看本地分支、远端跟踪引用、ahead/behind、worktree 和未提交变更;
- 发现 `CURRENT`、功能矩阵、发布门禁、Git 与 Docker 之间的漂移;
- 导出一个自包含 HTML,作为某一时点的项目快照。
### 已确定的产品决策
#### PKD-1:独立本地工具
采用独立 Go CLI 和本地 Web 页面,不加入现有产品后台。
(session-settled: user-approved — chosen over product-admin integration: the console is for the repository owner’s local engineering management and the production image excludes `.doc` and `.git`)
#### PKD-2:只读实时页与离线快照共用数据模型
实时服务和导出文件必须由同一份版本化快照生成,避免在线页面与离线报告出现两套口径。
(session-settled: user-approved — chosen over a static-only report: the requested console must follow agent tasks and project state as they change)
### 核心需求
| ID | 需求 |
|---|---|
| R1 | CLI 默认解析当前 Git 仓库根,也接受显式 `--repo`;页面始终显示绝对根路径、当前分支、HEAD 和采集时间。 |
| R2 | 仅监听 `127.0.0.1`,不依赖产品容器、产品数据库或产品登录。 |
| R3 | 架构与模块页聚合 `module-boundaries.yaml`、系统设计索引和 `FEATURE-MATRIX`,展示模块、能力、依赖和证据链。 |
| R4 | 任务状态至少拆为 `doc_status`、Git facets、`verification_result`/`verification_freshness`、deployment facets;可并存事实不得压成单值枚举。 |
| R5 | Git 页展示本地/跟踪分支、ahead/behind、最近提交、worktree、dirty/untracked 和任务声明匹配情况;不得隐式 `fetch`。 |
| R6 | 部署页按 shared/dev/test/main 分别展示容器状态、应用 readiness、服务完整性、schema、镜像与 promotion receipt;不得计算未经定义的综合绿灯。 |
| R7 | 文档页支持按 taxonomy、状态、模块和关键词筛选,展示正文、正向链接、反向链接、broken、orphan 与 unindexed 状态;查询状态可通过 URL 恢复。 |
| R8 | 一个不可变快照包含 `schema_version`、`generation_id`、`revision_id`、`generated_at`、仓库/提交身份、来源状态、事实与冲突。 |
| R9 | 自动刷新采用完整快照原子切换;每个来源独立超时,失败时保留最近成功数据并标注过期。 |
| R10 | 每条关键事实标注 `declared`、`observed`、`verified` 或 `inferred`,并保留来源路径和采集时间。 |
| R11 | 单 HTML 内嵌结构化模型、页面资源和允许导出的 Markdown 正文;附件只保留元数据及相对链接,并显示内容覆盖清单。 |
| R12 | 对 Agent 暴露稳定的只读 JSON,而不是让 Agent 解析 HTML;JSON 与页面引用同一 `generation_id` 和 `revision_id`。 |
| R13 | TaskState 显示声明的 owner/Agent 类型/认领/mutex 与基于 Git 的最近活动证据;Herdr 工程 Agent 和产品 PI Agent Runner 使用不同类型。没有运行态来源时必须显示 unknown,不得把“已认领”写成“正在执行”。 |
| R14 | 文件、命令和 HTTP 均采用 allowlist;拒绝路径穿越、symlink 越界、原始 HTML 执行、远程资源加载和凭证读取。 |
### 事实源与权威边界
| 领域 | 权威来源 | 中控台处理方式 |
|---|---|---|
| 发布门禁 | `.doc/remediation/gap-matrix.md` | 只解释发布 blocker,不替代能力完成度。 |
| 能力成熟度 | `.doc/status/FEATURE-MATRIX.md` | 显示功能完成度,不据此推断是否部署。 |
| 当前焦点、认领、集成槽 | `.doc/ops/CURRENT.md` | 作为团队声明,与 Git 和运行态对账。 |
| 任务计划 | `ops/short-term`、`ops/long-term`、backlog front matter | 作为计划状态,不据此推断实现。 |
| 分支与 worktree | Git plumbing | 作为本地观测;远端状态注明“基于本地 refs,未联网刷新”。 |
| 环境运行态 | Docker/Compose 元数据与 `/ready` | 分开展示容器、应用与服务完整性。 |
| 验收证据 | `.doc/test-reports` 及 promotion receipts | 显示证据存在性与身份,不以文件名替代内容校验。 |
来源之间不设全局覆盖顺序。各来源回答自己的问题;值不一致时生成 drift,并并列展示原值、时间和来源。
### 用户流程
```mermaid
flowchart LR
Start[启动 serve 或 export] --> Root[解析显式 repo root]
Root --> Collect[并行采集文档 Git 运行态]
Collect --> Snapshot[构建不可变快照]
Snapshot --> Reconcile[按领域对账]
Reconcile --> Live[本地实时页面和 JSON]
Reconcile --> Export[单文件 HTML]
Live --> Refresh[定时生成下一快照]
Refresh --> Snapshot
```
总览默认优先显示 `in_progress`、`blocked`、`planned`、`partial/deferred`、drift 和 degraded。`done` 与 archive 默认收起,避免历史材料淹没当前工作。
任务详情按照以下证据链导航:
```mermaid
flowchart LR
Audit[audit 问题] --> Remediation[remediation 方案]
Remediation --> Task[任务声明]
Task --> Git[分支 worktree commit merge]
Git --> Test[测试与验收报告]
Test --> Deploy[环境 artifact 与 readiness]
```
显式 Markdown 链接和既定 taxonomy 属于强关系;仅由文件名或 slug 推断的关系标为“候选”,不得参与完成度计算。
### 状态模型
```mermaid
flowchart TB
D[doc_status: planned/in_progress/blocked/done] --> View[并列状态视图]
G[Git facets: branch/worktree/merge/cleanliness/ahead-behind] --> View
V[Verification: result + freshness + bound identity] --> View
P[Deployment facets: container/readiness/services/artifact identity] --> View
View --> Drift{来源是否一致}
Drift -->|是| Consistent[consistent]
Drift -->|否| Conflict[drift + 双方证据]
```
“实装”定义为存在可核对的环境观测证据,而不是任务文档为 `done`。容器可达但 artifact identity 无法核对时显示“运行可见、版本未验证”,不得提升为 verified deployment。当文档声明 healthy、Docker 显示异常而 `/ready` 为 ok 时,页面保留多值并标记 drift,不输出统一绿灯。
### 真实验收样本
1. rdev:存在调研、设计、任务与 backlog,但若没有 CURRENT 认领和真实分支,应显示“已计划、未认领、未实施、未实装”。
2. main 环境:若 CURRENT 声明整体 healthy,而 events 容器实际 restarting、应用 `/ready` 仍为 ok,应同时显示三项证据与 drift。
3. 本地 dev:若分支领先 `origin/dev`,必须显示“本地已具备、远端未确认可用”,不得写成已远程发布。
4. `system-admin-console`:作为产品管理后台能力,与本计划的个人工程中控台分开展示,名称和边界不得混淆。
### 安全与非目标
一期明确不做:
- 不写文档,不修改任务状态,不占用集成槽;
- 不创建、切换、合并、删除或推送 Git 分支;
- 不执行 `git fetch`,不调用远端托管平台 API;
- 不启动、停止、重建或部署容器;
- 不控制 Herdr 或向 Agent 派发任务;
- 不读取 `.env`、`.secrets`、Docker `Config.Env`、数据库数据或 `.git` 内部文件正文;
- 不加入产品 API、产品前端、产品数据库或生产镜像;
- 不执行 Markdown 原始 HTML、脚本、Mermaid 或远程资源。
后续候选包括跨快照历史、远端 CI/Gitea 聚合、受限 Markdown/Mermaid 渲染、Agent 查询 API 和修复建议。任何写操作继续保持在本工具之外。
---
## Planning Contract
### High-Level Technical Design
以下图示冻结边界和协议,不规定具体函数签名。
```mermaid
flowchart LR
Docs[.doc sources] --> DC[Document collector]
Git[Git/worktrees] --> GC[Git collector]
Run[Docker/ready/receipts] --> RC[Runtime collector]
DC --> Build[Snapshot builder]
GC --> Build
RC --> Build
Build --> Rec[Reconcile facts and conflicts]
Rec --> JSON[Read-only JSON]
Rec --> Web[Local HTML]
Rec --> File[Offline HTML]
```
```mermaid
sequenceDiagram
participant UI as Browser
participant C as Collection coordinator
participant S as Sources
participant P as Snapshot publisher
UI->>C: poll with revision_id
C-->>UI: current snapshot immediately
C->>S: singleflight collection with deadlines
S-->>C: facts or source error
C->>P: publish complete generation atomically
P-->>UI: new revision or not-modified
```
```mermaid
stateDiagram-v2
[*] --> Loading
Loading --> Fresh: first collection succeeds
Loading --> ErrorUnknown: first collection fails
Fresh --> Refreshing: TTL expires
Refreshing --> Fresh: new generation succeeds
Refreshing --> Stale: source fails and last-known exists
Stale --> Fresh: source recovers
ErrorUnknown --> Fresh: source first succeeds
```
### 技术决策
#### KTD-1:采用仓库内独立 Go CLI
新增 `cmd/engineering-dashboard` 与 `internal/engineeringdashboard`,复用仓库 Go 工具链但不导入产品业务包。Go 标准库足以提供本地 HTTP、资源嵌入、JSON、并发和原子文件输出;现有 `yaml.v3` 可用于已定义的 YAML 契约。
#### KTD-2:快照是唯一交付模型
采集器只生产事实,reconcile 层只生产派生状态和冲突,HTTP/API/export 只消费已完成的不可变快照。快照至少包含:
```text
schema_version, generation_id, revision_id, generated_at, collection_duration
repository { root, branch, head, dirty }
sources[] { name, status, observed_at, last_success_at, error }
facts[] { subject, field, value, provenance, source_ref, observed_at, confidence }
conflicts[] { subject, field, kind, fact_refs[] }
documents[], modules[], tasks[], git[], environments[]
```
`generation_id` 唯一标识一次采集,包含采集批次语义;`revision_id` 只由 schema、仓库身份和规范化的非易变事实、冲突、来源状态确定,明确排除 `generated_at`、`observed_at` 和采集耗时。HTML 与 JSON 必须展示同一对标识,HTTP ETag 和前端是否重绘使用 `revision_id`。一期不读取旧 schema 的外部 JSON;离线 HTML 自带对应 renderer,因此不依赖未来二进制迁移。
#### KTD-3:专用解析器与容错索引并存
对 CURRENT、FEATURE-MATRIX、gap-matrix、任务 front matter 和 module boundaries 编写契约化解析器。文档层只索引 promotion receipt 的路径与链接,结构化部署凭证由运行态采集器唯一负责。对其余 Markdown 只提取安全元数据、标题、正文与链接。专用解析器失败时保留原文入口并标记 degraded,不凭模糊规则编造状态。
#### KTD-4:命令执行采用固定 argv 和超时
Git 与 Docker 采集通过注入式 command runner 执行固定程序和分离 argv,不通过 shell 拼接。`--repo` 先转为绝对、symlink-resolved 的 Git 根并作为单个参数传递。每个来源默认 2 秒超时;错误输出做长度限制和敏感字段清理。Git 使用 porcelain/plumbing 输出,例如 `status --porcelain=v2`、`worktree list --porcelain`、`for-each-ref`、`rev-list`、`merge-base`。
#### KTD-5:一期采用短轮询,不引入持久数据库
服务端由单一采集协调器按 TTL 触发完整重采集,2–5 秒刷新;同一仓库最多一轮采集在途,请求只读取当前快照,不直接叠加扫描。每轮带单调 generation 序号和整轮 deadline,只有当前有效轮次能原子发布。页面使用 ETag/`revision_id` 避免重复传输。last-known 只在同一 `serve` 进程内有效;冷启动或单次 export 首次采集失败时显示 unknown/error,不伪造历史值。文件监听、SSE 通知、持久缓存和历史数据库均后置。
#### KTD-6:安全阅读优先于富渲染
在线详情页一期将 Markdown 全部作为纯文本安全转义,并保留换行和空白;标题、列表、链接、代码、图片和 Mermaid 均显示源码,不生成 HTML 节点或发起资源请求。静态导出内嵌同一正文和内部导航。所有文档 ID 都是规范化仓库相对路径,只允许 `.doc/**/*.md` 及明确列入 allowlist 的根 Markdown;读取前后都校验解析路径,直接拒绝 symlink,并对 `.git`、`.env*`、`.secrets`、`data` 等敏感路径执行最终目标 denylist。
#### KTD-7:导出为自包含、有限尺寸的证据快照
导出将模型、CSS、JS 和允许的 Markdown 正文写入单 HTML,采用临时文件加 rename 原子落盘,默认 `0600`。数据使用 HTML-safe JSON 或等价编码封装,正文只通过 `textContent`/DOM API 写入;CSP 禁止网络、外部资源和内联事件执行。默认只嵌入 Git tracked、allowlist 内的 Markdown;untracked Markdown 只列元数据,除非用户显式选择。导出前输出 inclusion manifest 与敏感模式告警;`.doc/**/assets`、数据库、构建产物和二进制报告不嵌入。
### 建议目录
```text
cmd/engineering-dashboard/
main.go
internal/engineeringdashboard/
model.go
collector.go
source_docs.go
source_git.go
source_runtime.go
reconcile.go
server.go
export.go
assets/
index.html
app.js
app.css
testdata/
docs/
git/
runtime/
scripts/
engineering-dashboard.sh
.doc/test-reports/
YYYY-MM-DD-engineering-dashboard-test-report.md
```
### 风险与缓解
| 风险 | 缓解 |
|---|---|
| 文档结构并不完全统一 | 只对 SSOT 和任务 front matter 使用严格契约;其余文档容错索引并暴露解析告警。 |
| 看板制造“假完成” | 多轴 facets、事实 provenance、验证身份绑定、冲突不覆盖、真实反例测试。 |
| Docker/Git 卡住或不可用 | 独立超时、并行采集、last-known 状态、degraded 页面。 |
| 文档 XSS 或路径穿越 | 纯文本渲染、HTML-safe 数据封装、CSP、路径 allowlist、拒绝 symlink、最终目标敏感路径 denylist。 |
| `.doc` 附件导致扫描/导出失控 | 默认跳过 assets 内容,只采集元数据;设置单文档和总正文上限并报告截断。 |
| 导出副本离开本机后 `0600` 不再提供保护 | 页面首部标明敏感快照、仓库身份和生成时间;输出 inclusion manifest,交接者自行控制接收者、保留期与删除。 |
| worktree 与主 checkout 混淆 | 只管理 `--repo` 指定/解析出的根,页面常驻显示根与 HEAD;其他 worktree 仅作为 Git 元数据。 |
| 本地 remote refs 被误认为远端实时状态 | 显示 refs 观测时间和“未联网刷新”,不自动 fetch。 |
| 与产品 `system-admin-console` 命名冲突 | CLI、包和文档统一使用 `engineering-dashboard` / “个人工程中控台”。 |
---
## Implementation Units
### U1:冻结快照、事实与状态契约
**目标**:先建立不会把计划、实现、验证、部署混为一谈的模型与测试夹具。
**覆盖需求**:R4、R8、R10、R12、R13;承接 PKD-2 的同源快照决策。
**依赖**:无。
**文件**:
- `internal/engineeringdashboard/model.go`
- `internal/engineeringdashboard/model_test.go`
- `internal/engineeringdashboard/testdata/**`
**实施要点**:
1. 定义版本化 `Snapshot`、`SourceState`、`Fact`、`Conflict`、`TaskState`、`AgentClaim`、`EnvironmentState`。
2. provenance 固定为 `declared|observed|verified|inferred`;freshness 固定为 `fresh|stale|error|unknown`。
3. 状态使用可组合 facets:Git 分为 branch/worktree/merge/cleanliness/ahead-behind;验证分为 result/freshness/subject identity;部署分为 container/readiness/services/artifact identity。
4. TaskState 保留 owner、agent kind、claim、mutex、声明分支、观测 worktree、最近活动时间及证据;声明与观测不可互相提升。
5. 建立 rdev、dev ahead、main events restarting、CURRENT/worktree 不匹配等夹具。
**测试场景**:
- 文档 `done` 但无 merge/deploy 时,Git 与部署 facets 不改变;
- `claimed` 但无可观测运行信号时,Agent 活动保持 unknown;Herdr 与产品 PI Runner 不共享类型;
- 同字段多来源不一致时生成 conflict 并保留所有 fact 引用;
- JSON round-trip 保留 schema 与 snapshot identity;
- 枚举未知值失败且错误可定位。
**完成证据**:模型测试通过,schema 示例落入 Go fixture,不存在页面专用的第二套状态类型。
### U2:实现文档图谱与领域解析器
**目标**:将 `.doc` taxonomy、模块、任务、测试和链接转换为可追溯文档图谱。
**覆盖需求**:R3、R7、R10、R11、R14。
**依赖**:U1。
**文件**:
- `internal/engineeringdashboard/source_docs.go`
- `internal/engineeringdashboard/docs_test.go`
**实施要点**:
1. 扫描 allowlist 内 Markdown,默认跳过任何 `assets` 目录正文;记录附件元数据。
2. 解析 front matter、标题、显式 Markdown 链接和反向链接。
3. 为 CURRENT、FEATURE-MATRIX、gap-matrix、任务文、module boundaries 和 test report 建立专用适配器;receipt 只在文档图谱中作为文档与链接,结构化解析归 U4。
4. 区分 `broken`、`orphan`、`unindexed`;slug 相似只形成候选关系。
5. 规范化路径并阻止 `..`、绝对路径和任何 symlink;最终目标再次应用扩展名 allowlist 与敏感路径 denylist。
**测试场景**:
- taxonomy 内文档可检索且反向链接正确;
- broken link 不导致整个索引失败;
- front matter 缺失或非标准时产生告警并仍可阅读;
- assets 不读正文,越界 symlink 被拒绝;
- rdev 文档链被发现,但没有被推断为已实现。
**完成证据**:文档索引能从 fixture 生成稳定 JSON,路径安全负例通过。
### U3:实现 Git 与 worktree 采集
**目标**:以只读 Git plumbing 形成可复现的分支、提交和 worktree 观测。
**覆盖需求**:R1、R4、R5、R10、R14。
**依赖**:U1。
**文件**:
- `internal/engineeringdashboard/source_git.go`
- `internal/engineeringdashboard/git_test.go`
**实施要点**:
1. 抽象 command runner,固定 argv、工作目录、超时和输出上限。
2. 收集当前分支/HEAD、dirty/untracked、local/remote-tracking refs、ahead/behind、merge-base 和 worktree。
3. 不执行 fetch;remote tracking ref 始终带本地观测时间与免责声明。
4. 对账任务声明的 branch/worktree,但不因路径名相似而认定一致。
**测试场景**:
- 本地分支领先 origin 时显示 ahead 且不显示“远端可用”;
- worktree 目录名与真实检出分支不一致时生成 drift;
- 命令超时、Git 不存在、非 Git 目录时单源 degraded;
- runner 记录中不存在 shell、fetch、push 或写命令。
**完成证据**:临时 Git 仓库集成测试和 fake runner 单元测试通过。
### U4:实现运行态与部署证据采集
**目标**:按环境独立呈现容器、应用 readiness、服务完整性、schema、镜像和晋升凭证。
**覆盖需求**:R4、R6、R10、R14。
**依赖**:U1。
**文件**:
- `internal/engineeringdashboard/source_runtime.go`
- `internal/engineeringdashboard/runtime_test.go`
**实施要点**:
1. 从仓库内批准的 Compose 静态配置和 allowlist labels 映射环境与服务;无法明确映射时显示 unknown,不用名称猜测。容器 JSON 只提取容器名、image/digest、状态、restart count、health,以及 allowlist 内的 Compose project/service labels;不复制 Env、Mounts、完整 NetworkSettings 或任意 labels。
2. 对 allowlist 中的本地 `/ready` 端点执行短超时、响应大小受限的请求;禁用重定向,或对每一跳重新校验 scheme、解析后 IP、端口和 host。
3. 解析 promotion receipt/candidate image 等仓库证据,保留 artifact identity。
4. 将 container health、app readiness、required-service completeness 分开建模。
**测试场景**:
- app ready 且 events restarting 时同时保留两项状态;
- Docker 不可用或 HTTP 超时时,其他数据源仍可输出;
- receipt 与容器 image 不一致时生成 deployment drift;容器可达但 identity 缺失时标记“运行可见、版本未验证”;
- readiness 重定向到外网或非 allowlist 本地端口时拒绝访问;
- 输出中不存在容器环境变量或凭证。
**完成证据**:fixture 和 fake HTTP/Docker runner 测试通过,main 分叉场景被覆盖。
### U5:实现对账、派生视图与新鲜度
**目标**:把来源事实组合成用户可判断的视图,但不替来源做未经定义的裁决。
**覆盖需求**:R3、R4、R6、R8、R9、R10、R13。
**依赖**:U2、U3、U4。
**文件**:
- `internal/engineeringdashboard/reconcile.go`
- `internal/engineeringdashboard/reconcile_test.go`
**实施要点**:
1. 按领域 SSOT 规则构建 module、task、environment 和 evidence-chain 视图。
2. 实现 conflict 分类:declared-vs-observed、task-vs-git、test-vs-subject、receipt-vs-runtime、stale-source、missing-evidence。
3. 快照构建期间每个来源独立记录 `observed_at`、持续时间和错误;成功后一次性发布。
4. 失败源只可复用同一 serve 进程的 last-known,并标注 stale、age 与 last-success;冷启动无缓存时为 unknown/error。过期数据不隐藏,但按年龄提升告警级别。
5. 测试报告只有在 commit/artifact identity 与当前 subject 对齐时才能派生 pass;身份缺失为 unbound,身份不匹配为 stale/drift。
**测试场景**:
- 三个真实样本得到预期多轴状态;
- 同一组输入顺序变化不改变规范化快照;
- 单源失败不会删除其他源,也不会重写 last-known 的观测时间;冷启动失败没有伪造 last-known;
- 旧测试报告、新 HEAD 与不同 image 不会派生当前验证通过;
- 恢复后 stale 自动清除并产生新 snapshot ID。
**完成证据**:reconcile table tests 覆盖一致、漂移、缺失、过期和恢复。
### U6:实现本地服务、总览与文档导航
**目标**:提供能快速判断异常并下钻证据的本地只读页面和 JSON。
**覆盖需求**:R1、R2、R3、R7–R10、R12–R14;承接 PKD-1 和 PKD-2。
**依赖**:U5。
**文件**:
- `internal/engineeringdashboard/server.go`
- `internal/engineeringdashboard/server_test.go`
- `internal/engineeringdashboard/assets/index.html`
- `internal/engineeringdashboard/assets/app.js`
- `internal/engineeringdashboard/assets/app.css`
- `cmd/engineering-dashboard/main.go`
**实施要点**:
1. `serve --repo <path> --addr 127.0.0.1:<port>`;一期无条件拒绝所有非 loopback 地址,包括通配、IPv6 非 loopback 和显式传入值。
2. 暴露 `/api/v1/snapshot`、`/api/v1/doc/<id>`、`/healthz`;所有接口只读。严格校验 Host/Origin/Fetch Metadata,不信任代理转发头;页面和 API 使用每次启动生成的不可预测访问令牌,降低 DNS rebinding 与跨站读取风险。
3. 页面分为总览、架构/模块、任务、Git、部署、文档和证据链。
4. 自动刷新完整快照,保留当前筛选、滚动位置、焦点和选中文档;ETag 未变化时不重绘。
5. 明确一级视图状态:initial loading、fresh empty、fresh success、partial/degraded with last-known、hard error without cache、refreshing、recovered。刷新中继续展示上一完整快照,直到下一版本原子替换。
6. 搜索覆盖标题、仓库相对路径、front matter 和未截断正文;不同维度用 AND、同一维度多选用 OR,默认先排当前任务和异常证据,再按匹配度与路径稳定排序。筛选、查询和选中文档写入 URL 参数,支持浏览器前进/后退与深链。
7. 桌面优先;窄屏下侧栏变为可关闭抽屉,宽表格保留可横向滚动的语义表头,详情区单列。所有功能可键盘完成,使用 landmark/标题/表格语义,drift/degraded 不只靠颜色表达,自动刷新通过非打断式 live region 报告且不抢焦点。
8. Markdown 正文只进入文本节点;在线页与导出页均设置限制性 CSP,不执行 HTML、脚本、SVG、远程 URL 或事件属性。
**测试场景**:
- 只监听 loopback,方法 allowlist 拒绝写请求;Host/Origin/token、DNS rebinding 和跨 Origin 负例被拒绝;
- HTML 与 JSON 的 generation/revision identity 一致;
- 文档 ID 越界、symlink 越界、未知 ID 返回安全错误;
- degraded source 在总览可见且页面仍可导航;
- 任务状态四轴、drift 和来源时间在浏览器中可见。
- 首次加载、空数据、无缓存错误、刷新、恢复状态可区分;键盘、焦点、语义结构、窄屏和非颜色告警验收通过。
- 搜索组合逻辑、排序、无结果、URL 深链和刷新后的视图保持通过。
**完成证据**:HTTP tests、基本无障碍检查和真实浏览器验收通过。
### U7:实现离线导出、启动脚本与治理文档
**目标**:生成安全、可携带、可追踪的单文件快照,并完成仓库治理接线。
**覆盖需求**:R1、R8、R9、R11、R14;承接 PKD-1 和 PKD-2。
**依赖**:U6。
**文件**:
- `internal/engineeringdashboard/export.go`
- `internal/engineeringdashboard/export_test.go`
- `scripts/engineering-dashboard.sh`
- `.doc/status/FEATURE-MATRIX.md`
- `.doc/ops/CURRENT.md`
- `.doc/test-reports/YYYY-MM-DD-engineering-dashboard-test-report.md`
**实施要点**:
1. `export --repo <path> --output <file>` 构建一次不可变快照并原子写入;首次采集失败的来源显示 unknown/error。
2. 以 HTML-safe JSON/等价编码内嵌允许的 Markdown 正文、索引和页面资源;附件保持元数据与相对链接,所有正文只写入文本节点。
3. 默认权限 `0600`,输出页显示生成时间、repo、HEAD、snapshot ID 和 degraded/drift。
4. 薄脚本只负责定位仓库与调用 Go CLI,不隐藏参数或执行安装/部署副作用。
5. 实施期间按仓库规范更新 CURRENT、FEATURE-MATRIX 和 test report;完成后再迁移任务生命周期状态。
**测试场景**:
- 导出文件脱离仓库后仍能搜索和阅读 Markdown;
- 导出中不含附件字节、绝对凭证路径、env 值或远程请求;`</script>`、事件属性、SVG、危险 URL scheme 和 Unicode 边界载荷不能逃逸数据上下文;
- 默认 tracked/untracked 与敏感模式策略、inclusion manifest 和覆盖清单符合契约;
- 采集部分失败时仍能导出并保留错误;
- 输出中 JSON/HTML snapshot identity 一致,权限符合预期;
- 大文档和总正文上限触发时明确标记截断。
**完成证据**:export tests、离线浏览器验收和治理文档回链完整。
---
## Verification Contract
### 自动验证
实施阶段至少运行:
```bash
go test ./internal/engineeringdashboard/...
go test ./cmd/engineering-dashboard/...
go vet ./...
go test -short ./...
git diff --check
```
涉及共享容器的只读验收也必须遵守 CURRENT 集成槽规则;中控台本身不得为测试启动、停止或重建共享容器。
### 契约验证矩阵
| 领域 | 必须证明 |
|---|---|
| 模型 | 计划、Git facets、验证、部署 facets 互不覆盖;Agent 声明和运行观测分离;所有派生结论可追溯到 facts。 |
| 文档 | taxonomy、全文检索、反链、broken/unindexed、路径安全与 assets 排除。 |
| Git | ahead/behind、worktree、dirty、local refs 新鲜度和无隐式 fetch。 |
| 部署 | container/app/service 三类信号分离,receipt/artifact 身份可核对。 |
| 降级 | 每个源超时、错误、stale、恢复都不会让整页不可用。 |
| 实时 | 变化在目标时间内形成完整新快照,不出现半新半旧卡片。 |
| 导出 | 单文件离线可读、默认 `0600`、不嵌 assets、不产生网络请求。 |
| 安全 | loopback、Host/Origin/startup token、read-only methods、命令 allowlist、路径边界、Docker 字段 allowlist、CSP 与输出脱敏。 |
### 浏览器验收
1. 从总览进入 rdev,确认“计划/实施/验证/实装”四轴与源文档链接均可见。
2. 在仓库外复制导出 HTML,断网打开并全文搜索、阅读至少一份设计与一份测试报告。
3. 制造 fixture 中的 CURRENT/Docker/readiness 冲突,确认页面保留多值且不出现综合绿灯。
4. 切换 fixture 快照,确认页面刷新后筛选条件和当前文档保持不变。
5. 尝试路径穿越、未知文档、POST、DNS rebinding、跨 Origin、readiness 重定向和含原始 HTML/脚本逃逸载荷的 Markdown,确认均不能越界、外联或执行。
### 性能与容量验证
- 记录当前 `.doc` 规模下的冷启动、增量刷新、JSON 大小和 HTML 导出大小。
- 建议一期门槛:UI shell 与来源状态在 2 秒内可交互,P95 完整快照重建不超过 5 秒,单源超时不超过 2 秒;基线不达标时必须记录实测并拆分后台正文索引,不能伪造 PASS。
- 导出达到配置上限时必须显式列出被截断文档,不允许静默丢失。
---
## Definition of Done
- [ ] `serve` 和 `export` 在显式仓库根下可重复运行,且没有产品后台依赖。
- [ ] 实时 HTML、离线 HTML 与 JSON 使用同一版本化快照契约。
- [ ] `generation_id` 标识采集实例,`revision_id` 标识内容版本并驱动 ETag;无内容变化不会触发重绘。
- [ ] 架构、模块、功能、任务、Git、部署、文档和证据链均可从页面访问。
- [ ] 计划、实施、验证、实装四轴独立,rdev、dev ahead、main events 分叉样本通过。
- [ ] Agent 认领与可观测活动分开,Herdr 工程 Agent 与产品 PI Agent Runner 不混称。
- [ ] 所有 drift、degraded、stale 都带来源和时间,不存在未经定义的综合绿灯。
- [ ] 默认 loopback、Host/Origin/startup token、只读命令、路径边界、脱敏、CSP 和 Markdown 安全测试通过。
- [ ] 首次加载、空数据、部分失败、无缓存失败、恢复、键盘、窄屏和 URL 深链验收通过。
- [ ] 导出 HTML 脱离仓库可读 Markdown,且不包含二进制 assets 或凭证数据。
- [ ] 单元、集成、全仓短测、浏览器验收和 `git diff --check` 均有真实输出。
- [ ] `.doc/test-reports` 报告回链任务文,FEATURE-MATRIX 与 CURRENT 按实际状态更新。
- [ ] 没有遗留调试入口、写操作按钮、未使用的替代模型或与产品后台重名的组件。
---
## Appendix
### 一期交付边界
一期交付:本地只读服务、版本化快照 JSON、架构/任务/Git/部署/文档视图、四轴状态、drift/degraded、全文搜索、安全文档阅读和单 HTML 导出。
后续评估:跨快照历史趋势、远端托管/CI 聚合、受限富文本与 Mermaid、跨仓库聚合、面向 Agent 的筛选查询 API。
永久排除:在页面中修改文档、切换或推送分支、控制 Agent、执行部署、读取密钥、成为产品后台模块。
### 方案依据
- `.doc/README.md` 定义的文档 taxonomy 与生命周期;
- `.doc/ops/CURRENT.md` 的焦点、认领、集成槽与环境声明;
- `.doc/status/FEATURE-MATRIX.md` 的模块完成度口径;
- `.doc/remediation/gap-matrix.md` 的发布门禁口径;
- `.doc/system-design/README.md` 与模块边界清单;
- Git/worktree、Docker/Compose、`/ready` 和 promotion receipts 的当前可观测能力。
@@ -1,54 +0,0 @@
---
title: "刷新后对话正文消失问题定位与整改方案"
status: done
created: 2026-09-13
updated: 2026-09-13
owner: codex
branch: dev
worktree: "-"
mutex: chat
---
# 刷新后对话正文消失问题定位与整改方案
## 目标
定位页面刷新后对话正文不显示、但锚点与过滤计数仍存在的根因,并形成可执行、可验证的整改方案。
## 范围
- 前端对话状态、会话恢复、消息窗口、锚点与类别过滤的数据来源
- 后端会话/消息持久化与历史读取 API
- 当前 dev 运行态的只读接口与数据一致性验证
- 审计记录、整改方案与验收标准
## 非目标
- 本轮不修改业务代码
- 不执行破坏性数据修复
- 不把 stub 或仅内存态结果作为最终验收
## 步骤
1. [x] 复核刷新前后前端状态初始化和会话选择链路
2. [x] 核对历史消息 API、存储字段及运行态返回
3. [x] 解释正文、锚点和过滤计数数据源为何分叉
4. [x] 输出 audit 与 remediation 文档并回链
## 验收标准
- [x] 根因有源码、接口或运行态证据支撑
- [x] 明确影响范围、触发条件与风险等级
- [x] 整改方案覆盖实现、回归测试、数据兼容和验收
## 相关链接
- Checklist: 待整改实施时建立
- Handoff: [chat-history-refresh-diagnosis](../../ops/handoffs/2026-09-13-chat-history-refresh-diagnosis.md)
- Test report: 待整改实施并验收后建立
## 证据 / 备注
- 用户实测:新对话能正常生成文档;刷新后历史对话正文消失,但右侧锚点与顶部过滤仍显示对应消息数量。
- Audit: [../../audit/2026-09-13-chat-history-refresh-disappears.md](../../audit/2026-09-13-chat-history-refresh-disappears.md)
- Remediation: [../../remediation/2026-09-13-chat-history-refresh-remediation.md](../../remediation/2026-09-13-chat-history-refresh-remediation.md)
@@ -1,58 +0,0 @@
---
title: "修复对话刷新恢复与授权统计不一致"
status: done
created: 2026-09-13
updated: 2026-09-15
owner: Cursor
branch: fix/chat-history-refresh
worktree: ".worktrees/fix-chat-history-refresh"
mutex: chat
---
# 修复对话刷新恢复与授权统计不一致
## 目标
按整改方案修复消息作用域写入、历史兼容、读取授权和前端恢复态,并完成真实 PostgreSQL 与 PI 文档生成后的刷新验收。
## 范围
- 消息和 task run 的不可变工作流实例/阶段作用域
- 会话 owner 与阶段可见性的统一服务端策略
- 窗口、日期、分类、搜索、摘要、未读、导出、锚点的同集查询
- 现有消息 dry-run/backfill
- 前端窗口错误态和用户隔离缓存
- 自动化与真实 PI E2E 证据
## 非目标
- 不放宽现有阶段可见性规则
- 不用前端缓存替代服务端持久化
- 不对无法唯一归属的历史消息盲目回填当前阶段
## 步骤
1. [x] 先补可稳定复现本缺陷的 PG 集成与前端恢复测试
2. [x] 实现统一消息作用域解析与写入
3. [x] 实现统一会话/消息授权查询及统计同集
4. [x] 实现历史 dry-run/backfill 与对账
5. [x] 完善前端恢复状态及用户隔离缓存
6. [x] 执行全量门禁、真实 PI 闲聊刷新 E2E 和双用户负例(编制任务激活链 save 400 未纳入本轮)
## 验收标准
- [x] [整改方案](../../remediation/2026-09-13-chat-history-refresh-remediation.md) 的验收项(除真实 PI E2E)有证据
- [x] `CHAT-HISTORY-REFRESH` 在 gap-matrix 中由 FAIL 更新为 PASS
- [x] 测试报告归档并回链
## 相关链接
- Checklist: 实施开始时复制模板建立
- Handoff: [../handoffs/2026-09-13-chat-history-refresh-diagnosis.md](../handoffs/2026-09-13-chat-history-refresh-diagnosis.md)
- Test report: [../../test-reports/2026-09-13-chat-history-refresh-test-report.md](../../test-reports/2026-09-13-chat-history-refresh-test-report.md)
## 证据 / 备注
- Audit: [../../audit/2026-09-13-chat-history-refresh-disappears.md](../../audit/2026-09-13-chat-history-refresh-disappears.md)
- Remediation: [../../remediation/2026-09-13-chat-history-refresh-remediation.md](../../remediation/2026-09-13-chat-history-refresh-remediation.md)
- Live: [../../test-reports/assets/2026-09-15-chat-history-refresh-live/live.json](../../test-reports/assets/2026-09-15-chat-history-refresh-live/live.json)(项目 6252,window=categories=2,guest 403)
@@ -1,59 +0,0 @@
---
title: "修复查询误触发写任务与任务状态刷新退化"
status: done
created: 2026-09-13
updated: 2026-09-15
owner: Cursor
branch: docs/conversation-intent-dual-tab
worktree: "-"
mutex: intent
---
# 修复查询误触发写任务与任务状态刷新退化
## 目标
修复只读查询误启动文档、刷新丢失任务卡片能力及文档编辑状态不可见,并建立诊断数据隔离门禁。
## 范围
- 模板任务动作识别及负例测试
- 任务错误/进度/恢复上下文持久化与历史重建
- 文档租约/运行态的 UI 展示和重复启动前置拦截
- 隔离 fixture 验收与真实 PI 刷新 E2E
## 非目标
- 未经项目创建者确认,不软删除已污染消息或删除误启动产物
- 不放宽文档租约与工作流权限规则
## 步骤
1. [x] 核对真实会话、任务运行、事件和文档租约证据
2. [x] 补只读意图与刷新恢复失败测试
3. [x] 收紧写任务动作识别并修复 busy 错误分型
4. [x] 实现任务/租约状态刷新恢复与统一提示
5. [x] 实现命名文档的服务端鉴权只读总结(“总结”不止是不写入)
6. [x] 执行前端、Go、PG 与真实 PI 双标签页验收
- [x] Go、前端、构建、dev 重建与真实 PI 只读总结
- [x] 服务端 busy 预检不创建 run,并持久化无重试状态卡
- [x] 浏览器刷新恢复与双标签页 busy 可见性(项目 6275;禁止项目 143)
## 验收标准
- [x] [整改方案](../../remediation/2026-09-13-conversation-intent-runtime-state-remediation.md) 全部验收项有证据
- [x] `CHAT-INTENT-STATE` 由 FAIL 更新为 PASS
- [x] test-report 归档并回链
## 相关链接
- Checklist: 本任务验收标准
- Handoff: [../../ops/handoffs/2026-09-15-conversation-intent-dual-tab.md](../../ops/handoffs/2026-09-15-conversation-intent-dual-tab.md)
- Test report: [../../test-reports/2026-09-13-conversation-intent-runtime-state-test-report.md](../../test-reports/2026-09-13-conversation-intent-runtime-state-test-report.md)
## 证据 / 备注
- Audit: [../../audit/2026-09-13-conversation-intent-runtime-state.md](../../audit/2026-09-13-conversation-intent-runtime-state.md)
- Remediation: [../../remediation/2026-09-13-conversation-intent-runtime-state-remediation.md](../../remediation/2026-09-13-conversation-intent-runtime-state-remediation.md)
- 双标签活验:项目 **6275** / `sess-p6275-u10` / `run_1789452602295343365`;产物 `.doc/test-reports/assets/2026-09-15-conversation-intent-dual-tab/`
- 未改写项目 143,未删除 `sess-p143-u9` 探针
@@ -1,47 +0,0 @@
---
title: "当前受控文档指示语优先于领域关键词路由"
status: done
created: 2026-09-13
updated: 2026-09-14
owner: Cursor-Auto
branch: fix/document-revision-active-doc-routing
worktree: "-"
mutex: docgov
---
# 当前受控文档指示语优先于领域关键词路由
## 目标
用户说「当前受控文档/当前文档/本文件/这份文档」且已选中服务端注册的 `doc_proj*` 时,任务 payload 为该文档 `taskKey`+`docId`;UI-05 提示须为 `intake` + `doc_proj6109_intake`。
## 范围
- `web/src/engine/templateMatch.ts` + App 发送/重试链
- 单测与边界;服务端 mismatch 复核(不信任客户端 doc_id 改 task)
- 文档:audit / gap-matrix / CURRENT
## 非目标
- 不改弱 E2E UI-05 断言;不操作容器;不触碰/提交 test-report assets
- 生产 `templateMatch.ts` 不导出用例编号/E2E 专属提示词;测试提示词留在 test 文件
## 步骤
1. [x] 认领 CURRENT;写 audit/short-term
2. [x] 指示语钉住 active 受控文档;显式点名可切换;只读不启动;模板槽不钉
3. [x] App 传入 activeDoc;payload 用一致 taskKey/docId
4. [x] 单测 + 门禁 + 原子提交
## 验收标准
- [x] UI-05 原文 + active intake → `intake` / `doc_proj6109_intake`
- [x] 只读「查看当前受控文档」不启动任务
- [x] 显式点名另一交付物可切换;模板-only 不钉住
- [x] 服务端 task_key 与已注册 doc 不一致仍拒绝
- [x] `go vet` / `go test -short` / web 242+27 / build / `git diff --check`
## 相关链接
- Audit: [../../audit/2026-09-13-document-revision-active-doc-routing.md](../../audit/2026-09-13-document-revision-active-doc-routing.md)
- Evidence: [../../test-reports/assets/2026-09-13-document-revision-runtime-ui/schema30-ui05-active-doc-routing-failure](../../test-reports/assets/2026-09-13-document-revision-runtime-ui/schema30-ui05-active-doc-routing-failure)
@@ -1,55 +0,0 @@
---
title: "职责单元格精确断言"
status: done
created: 2026-09-13
updated: 2026-09-14
owner: Cursor-Auto
branch: fix/document-revision-duty-cell-assertion
worktree: "-"
mutex: document-revision-duty-cell-assertion
---
# 职责单元格精确断言
## 目标
堵住第16轮 UI-13a:权限矩阵已打开,整行 `innerText` 含全部 select option,误命中「编制负责人」。改为读控件 value/badge,且 USER_B 必须精确 `reviewer`,不得接受 viewer 降级。
## 范围
- `web/src/lib/dutyCellAssertion.ts` 与单测
- `UserProjectRightsModal` 职责控件可访问语义
- `web/e2e/document-revision-runtime.spec.ts` UI-13a
- audit / remediation / CURRENT
## 非目标
- 不放宽 reviewer 只读;不删双击/无编辑提示检查
- 不碰证据;不合 dest;不启停容器;不 E2E;不 push
## 步骤
1. [x] 从 `dev@dd5671e` 开分支并登记 mutex
2. [x] 精确角色解析 + option 文案不得误判测试
3. [x] 产品控件 data-* + UI-13a 接线
4. [x] `npm test` + `npm run build` 并原子提交
5. [x] 独立审查收紧:只接受 reviewer;viewer 与 canAssignLead=true 拒绝
## 验收标准
- [x] select/badge 必须精确 `reviewer`;viewer/author/approver 拒绝
- [x] 整行 option 文案不得推断职责
- [x] select 必须不可配置且 disabled
- [ ] 现场 UI-13a(未跑)
## 相关链接
- Audit: [../../audit/2026-09-13-document-revision-duty-cell-assertion.md](../../audit/2026-09-13-document-revision-duty-cell-assertion.md)
- Remediation: [../../remediation/2026-09-13-document-revision-duty-cell-assertion.md](../../remediation/2026-09-13-document-revision-duty-cell-assertion.md)
## 证据 / 备注
- mutex:`document-revision-duty-cell-assertion`(新 mutex)
- 基线:`dev@dd5671e`
- 验证(收紧后):`npx tsx --test src/lib/dutyCellAssertion.test.ts` PASS(6);`cd web && npm test` PASS;`npm run build` PASS
- **未跑真实 UI-13a,不得标 done**;**不得 merge / 启停容器 / E2E / push**
@@ -1,51 +0,0 @@
---
title: "E2E:给真实文档块加稳定寻址并修正 UI-06/13b"
status: done
created: 2026-09-13
updated: 2026-09-14
owner: Cursor-Auto
branch: fix/document-revision-e2e-block-selector
worktree: "-"
mutex: document-revision-block-selector
---
# E2E:给真实文档块加稳定寻址并修正 UI-06/13b
## 目标
第六轮 UI-06 首错:`pure` 模式下块 wrapper 无 `data-overlay-kind`、正文也不是 `p`/`h1`。为每个真实 `DocumentBlock` wrapper 增加与 overlay 无关的稳定 DOM 标识;E2E 只在 `active-document-pane` 内定位该标识。不改视觉/权限/双击行为。不得将本任务标 `done`。
## 范围
- `web/src/lib/documentBlockDom.ts` + 契约单测
- `web/src/components/doc/BlockRenderer.tsx`
- `web/e2e/document-revision-runtime.spec.ts`(`openFirstPaneEditorAndFill`;UI-06/13b 复用,UI-13a 同步)
- 文档:audit / CURRENT
## 非目标
- 不改编辑/权限/overlay 视觉
- 不降低已有断言;不伪造、不直接打 API
- 不触碰/提交 `.doc/test-reports/assets`;不操作容器;本轮不重跑 E2E
- 不改 FEATURE-MATRIX
## 步骤
1. [x] 认领 CURRENT(mutex `document-revision-block-selector`);前序 reject-routing 保持 in_progress
2. [x] 真实块 wrapper 增加 `data-testid=document-block` + block id
3. [x] E2E 仅在 active pane 内按该标识双击
4. [x] 契约单测:pure 模式也有块标识,且不依赖 `data-overlay-kind`
5. [ ] 占槽后真实 UI 重跑(本轮不做)
## 验收标准
- [x] 块标识与 overlay 无关;带 block id
- [x] `openFirstPaneEditorAndFill` 不使用 overlay/`p`/`h1`/`h2`
- [x] web tests + `tsc`/build + `git diff --check`
- [ ] 真实 UI-06/13b PASS 后才可将本任务标 `done`
## 相关链接
- Audit: [../../audit/2026-09-13-document-revision-block-selector.md](../../audit/2026-09-13-document-revision-block-selector.md)
- Evidence: [../../test-reports/assets/2026-09-13-document-revision-runtime-ui/schema30-ui06-block-selector-failure](../../test-reports/assets/2026-09-13-document-revision-runtime-ui/schema30-ui06-block-selector-failure)
- 前序: [2026-09-13-document-revision-e2e-reject-routing.md](./2026-09-13-document-revision-e2e-reject-routing.md)
@@ -1,51 +0,0 @@
---
title: "E2E:纯净阅读按 document-block 取样 overlay"
status: done
created: 2026-09-13
updated: 2026-09-14
owner: Cursor-Auto
branch: fix/document-revision-e2e-overlay-selector
worktree: "-"
mutex: document-revision-overlay-selector
---
# E2E:纯净阅读按 document-block 取样 overlay
## 目标
第八轮 UI-07 首错:pure 模式用 `[data-overlay-kind],[class*=block]` 找不到真实块。在 `active-document-pane` 内对全部 `document-block` 取样真实样式/hunk;manual/all 不保证两两不同。不得将本任务标 `done`。
## 范围
- `web/e2e/document-revision-runtime.spec.ts`(UI-07 取样;UI-10 历史自动关闭;UI-16 text 选择器)
- `web/src/features/documentRevision/overlayMode.test.ts`(同一 human hunk 不保证 pairwise)
- 文档:audit / CURRENT
## 非目标
- 不新建 policy 抽象;不改 overlay 视觉/业务
- 不人为换块制造 manual≠all
- 不触碰/提交 `.doc/test-reports/assets`;不操作容器;本轮不重跑 E2E
- 不改 FEATURE-MATRIX
## 步骤
1. [x] 认领 CURRENT(mutex `document-revision-overlay-selector`)
2. [x] UI-07 在 pane `document-block` 上取样
3. [x] 按 checklist 校正三模式断言
4. [x] UI-10 按抽屉自动关闭比较
5. [ ] 占槽后真实 UI 重跑(本轮不做)
## 验收标准
- [x] 禁止 `[class*=block]` / 全页 overlay 取样
- [x] 纯净阅读必须无装饰;人工/全部必须有真实 hunk 装饰
- [x] web tests + `tsc`/build + `git diff --check`
- [ ] 真实 UI-07/08/09 PASS 后才可将本任务标 `done`
## 相关链接
- Audit: [../../audit/2026-09-13-document-revision-overlay-selector.md](../../audit/2026-09-13-document-revision-overlay-selector.md)
- Evidence: [../../test-reports/assets/2026-09-13-document-revision-runtime-ui/schema30-ui07-pure-selector-failure](../../test-reports/assets/2026-09-13-document-revision-runtime-ui/schema30-ui07-pure-selector-failure)
- Checklist: [../checklists/2026-09-13-document-revision-runtime-ui-acceptance.md](checklists/2026-09-13-document-revision-runtime-ui-acceptance.md)
- 前序: [2026-09-13-document-revision-e2e-save-selector.md](./2026-09-13-document-revision-e2e-save-selector.md)
@@ -1,46 +0,0 @@
---
title: "E2E:等 overlay CSS transition 结束后再取样"
status: done
created: 2026-09-13
updated: 2026-09-14
owner: Cursor-Auto
branch: fix/document-revision-e2e-overlay-transition
worktree: "-"
mutex: document-revision-overlay-transition
---
# E2E:等 overlay CSS transition 结束后再取样
## 目标
第九轮 UI-07 首错:`data-overlay-kind` 已空,但采样落在 200ms transition 中间帧。用 Playwright 轮询 computed style 直到稳定且达到无装饰目标后再取样。不得将本任务标 `done`。
## 范围
- `web/e2e/document-revision-runtime.spec.ts`(pure/manual/all 均等样式 settle)
- 文档:audit / CURRENT
## 非目标
- 不禁用产品 `transition`;不固定极短 sleep;不放宽纯净无装饰断言
- 不触碰/提交 `.doc/test-reports/assets`;不操作容器;本轮不重跑 E2E
- 不改 FEATURE-MATRIX;不合 `dev`
## 步骤
1. [x] 认领 CURRENT(mutex `document-revision-overlay-transition`)
2. [x] `expect.poll` 连续两帧相同且达到 mode 目标后再采样
3. [ ] 占槽后真实 UI 重跑(本轮不做)
## 验收标准
- [x] 纯净阅读仍要求透明底 + `box-shadow:none` + 无 overlay-kind
- [x] manual/all 也等 transition 完成
- [x] web tests + `tsc`/build + `git diff --check` + Go 门禁
- [ ] 真实 UI-07/08/09 PASS 后才可将本任务标 `done`
## 相关链接
- Audit: [../../audit/2026-09-13-document-revision-overlay-transition.md](../../audit/2026-09-13-document-revision-overlay-transition.md)
- Evidence: [../../test-reports/assets/2026-09-13-document-revision-runtime-ui/schema30-ui07-css-transition-sampling-failure](../../test-reports/assets/2026-09-13-document-revision-runtime-ui/schema30-ui07-css-transition-sampling-failure)
- 前序: [2026-09-13-document-revision-e2e-overlay-selector.md](./2026-09-13-document-revision-e2e-overlay-selector.md)
@@ -1,49 +0,0 @@
---
title: "E2E:待确认报告必须真实打开再确认/拒绝"
status: done
created: 2026-09-13
updated: 2026-09-14
owner: Cursor-Auto
branch: fix/document-revision-e2e-pending-flow
worktree: "-"
mutex: pending-report-ui
---
# E2E:待确认报告必须真实打开再确认/拒绝
## 目标
第四轮 UI-05a 首错修复:验收脚本按真实用户路径关闭首轮报告、打开「待确认报告」,在面板内断言 high(critical 允许)与 pending 动作后再确认/拒绝。不改产品业务逻辑。
## 范围
- `web/e2e/document-revision-runtime.spec.ts` UI-04 / UI-05a / UI-05b
- 文档:audit / CURRENT 认领(mutex `pending-report-ui`;与 reject-routing 的 `document-revision-runtime-ui` 分开,避免虚报 done)
## 非目标
- 不改 `ChangeReportPanel` / Toolbar / decision API
- 不降低已有业务断言或超时;不伪造、不直接打 API
- 不触碰/提交 `.doc/test-reports/assets`;不操作容器;本轮不重跑 E2E
- 不改 FEATURE-MATRIX
## 步骤
1. [x] 认领 CURRENT;写 audit/short-term
2. [x] UI-04 用弹窗内「关闭」并断言 dialog 消失
3. [x] UI-05a 点击「待确认报告」,断言 risk/pending-actions/确认提交后确认
4. [x] UI-05b 新 pending 后同样打开面板,断言 pending-actions/拒绝后再拒绝
5. [ ] 占槽后真实 UI 重跑(本轮不做)
## 验收标准
- [x] UI-04 不再使用无效 Escape
- [x] UI-05a/05b 不靠全局 count 代替打开待确认报告
- [x] web tests + `tsc`/build + `git diff --check`
- [ ] 真实 UI-05a/05b PASS 后才可将本任务标 `done`
## 相关链接
- Audit: [../../audit/2026-09-13-document-revision-pending-report-selection.md](../../audit/2026-09-13-document-revision-pending-report-selection.md)
- Evidence: [../../test-reports/assets/2026-09-13-document-revision-runtime-ui/schema30-ui05a-pending-report-selection-failure](../../test-reports/assets/2026-09-13-document-revision-runtime-ui/schema30-ui05a-pending-report-selection-failure)
- Checklist: [../checklists/2026-09-13-document-revision-runtime-ui-acceptance.md](checklists/2026-09-13-document-revision-runtime-ui-acceptance.md)
@@ -1,62 +0,0 @@
---
title: "E2E:UI-05b 钉住 intake 并收紧 UI-10/12/13/14"
status: done
created: 2026-09-13
updated: 2026-09-14
owner: Cursor-Auto
branch: fix/document-revision-e2e-reject-routing
worktree: "-"
mutex: document-revision-runtime-ui
---
# E2E:UI-05b 钉住 intake 并收紧 UI-10/12/13/14
## 目标
第五轮 UI-05b 首错修复:拒绝用例 prompt 必须带「当前受控文档《用户初始需求收集表》」,并在本轮 `POST /tasks/runs` 上严格断言 `task_key==='intake'` 且 `doc_id===controlledDocId`。同步收紧 UI-10/12/13/14 真实用户路径。本轮追加产品修复:权威文档职责 + 打开时基线 ETag。
## 范围
- `internal/docgov/project_docs.go`(summary 职责投影)
- `web/src` 职责字段、`resolveCurrentDocRole`、hydrate/PATCH ETag
- `web/e2e/document-revision-runtime.spec.ts`(UI-13b 真实竞争)
- 文档:audit / remediation / CURRENT(mutex `document-revision-runtime-ui`)
## 非目标
- 不降低已有业务断言或超时;不伪造、不直接打 API
- 不触碰/提交 `.doc/test-reports/assets`;不操作容器;本轮不重跑 E2E
- 不改 FEATURE-MATRIX
## 步骤
1. [x] 认领 CURRENT;前序 pending-flow 保持 in_progress,mutex 改为 `pending-report-ui`(仅 UI-05a 实战 PASS,UI-05b 尚未拒绝,不得虚报 done)
2. [x] UI-05b prompt + tasks/runs 契约断言 + 真实打开拒绝
3. [x] UI-10 历史 dialog 内选 A/B 比较并关闭;UI-12 项目不可见;UI-13 拆成审核人只读 + 双 A 冲突;UI-14 同时锁 v/r
4. [x] 仅修 05a/05b/10 遗留弹窗对 UI-06 的确切遮挡
5. [x] 产品修复:权威职责 + viewer fail-closed + hydrate 基线 ETag
6. [x] UI-13b:A1 保存前 A2 编辑器已打开并填入文本;两窗口同一 r/etag
7. [x] 审查补强:controlled 缺 ETag fail-closed;viewer 只读批注;服务端零 id 不按 name 提权
8. [ ] 占槽后真实 UI 重跑(本轮不做)
## 验收标准
- [x] UI-05b 发送前等待 POST `/api/v1/tasks/runs`,`task_key`/`doc_id` 不符即 FAIL
- [x] UI-10 不点全局工具条「比较」
- [x] UI-12 不接受「项目可见但只查 marker」
- [x] UI-13a/13b 结果分别记录;B 不作正文编辑者
- [x] B/陌生人不会变 author;A 仍 author(Go + 前端单测)
- [x] stale hydrate ETag 用于 PATCH(不能用最新 ETag 掩盖冲突)
- [x] controlled 缺打开时 ETag 不得 PATCH 0:0;hydrate 5xx 进加载失败屏障
- [x] viewer 无新增批注入口
- [x] 服务端受控 duty id=0 不按 name 提权
- [x] web tests + `tsc`/build + `git diff --check`
- [ ] 真实 UI-05b+ 后段及 UI-13a/13b PASS 后才可将本任务标 `done`
## 相关链接
- Audit (05b 路由): [../../audit/2026-09-13-document-revision-e2e-reject-routing.md](../../audit/2026-09-13-document-revision-e2e-reject-routing.md)
- Audit (职责/ETag): [../../audit/2026-09-13-document-revision-duty-etag-overwrite.md](../../audit/2026-09-13-document-revision-duty-etag-overwrite.md)
- Remediation: [../../remediation/2026-09-13-document-revision-duty-etag-overwrite.md](../../remediation/2026-09-13-document-revision-duty-etag-overwrite.md)
- Evidence: [../../test-reports/assets/2026-09-13-document-revision-runtime-ui/schema30-ui05b-reject-routing-failure](../../test-reports/assets/2026-09-13-document-revision-runtime-ui/schema30-ui05b-reject-routing-failure)
- 前序: [2026-09-13-document-revision-e2e-pending-flow.md](./2026-09-13-document-revision-e2e-pending-flow.md)
@@ -1,51 +0,0 @@
---
title: "E2E:块编辑 dialog 内精确保存"
status: done
created: 2026-09-13
updated: 2026-09-14
owner: Cursor-Auto
branch: fix/document-revision-e2e-save-selector
worktree: "-"
mutex: document-revision-save-selector
---
# E2E:块编辑 dialog 内精确保存
## 目标
第七轮 UI-06 首错:双击已打开编辑器,但全页模糊「保存」点到聊天私密库按钮,未 PATCH。给 `BlockEditorModal` 可访问 dialog + 稳定 aria-label;保存只在该 dialog 内 `exact: true` 点「保存修改」。不得将本任务标 `done`。
## 范围
- `web/src/lib/blockEditorDialog.ts` + 契约单测
- `web/src/components/doc/BlockEditorModal.tsx`
- `web/e2e/document-revision-runtime.spec.ts`(UI-06/13b 复用;UI-13a dialog=0)
- 文档:audit / CURRENT
## 非目标
- 不改视觉/保存业务
- 不降低已有断言
- 不触碰/提交 `.doc/test-reports/assets`;不操作容器;本轮不重跑 E2E
- 不改 FEATURE-MATRIX
## 步骤
1. [x] 认领 CURRENT(mutex `document-revision-save-selector`)
2. [x] dialog `role` + `aria-label=编辑受控块`
3. [x] E2E 在 dialog 内精确点「保存修改」
4. [x] UI-13a 断言编辑 dialog 不出现
5. [ ] 占槽后真实 UI 重跑(本轮不做)
## 验收标准
- [x] 契约单测钉住 dialog label 与 exact 保存文案
- [x] 禁止全页 `/保存/`
- [x] web tests + `tsc`/build + `git diff --check`
- [ ] 真实 UI-06/13b PASS 后才可将本任务标 `done`
## 相关链接
- Audit: [../../audit/2026-09-13-document-revision-save-selector.md](../../audit/2026-09-13-document-revision-save-selector.md)
- Evidence: [../../test-reports/assets/2026-09-13-document-revision-runtime-ui/schema30-ui06-save-selector-failure](../../test-reports/assets/2026-09-13-document-revision-runtime-ui/schema30-ui06-save-selector-failure)
- 前序: [2026-09-13-document-revision-e2e-block-selector.md](./2026-09-13-document-revision-e2e-block-selector.md)
@@ -1,61 +0,0 @@
---
title: "编辑弹窗 hydration 竞态修复"
status: done
created: 2026-09-13
updated: 2026-09-14
owner: Cursor-Auto
branch: fix/document-revision-editor-hydration-race
worktree: "-"
mutex: document-revision-editor-hydration-race
---
# 编辑弹窗 hydration 竞态修复
## 目标
堵住第十二轮 UI-06:编辑弹窗打开期间后台 hydration 换块 ID,保存静默关窗且不发 PATCH。用户编辑期间与 PATCH 成功后,迟到 hydration 不得覆盖基线;找不到块 fail-closed。
## 范围
- `web/src/lib/controlledDocHydrate.ts`:`fetchRevisionState` 保留 `head_block_map`,hydrate 后 `applyHeadBlockMap`
- `web/src/lib/editorHydrationGate.ts` 与单测(迟到响应不得覆盖 PATCH 成功正文)
- `web/src/lib/blockSavePolicy.ts` 与单测(stale-id / doc 绑定 / 切文档 fail-closed)
- `web/src/lib/saveControlledBlockEdit.ts`:App 真实调用的 PATCH 编排(可注入 patch API)
- `web/src/App.tsx`:`editorSession`、关窗续跑、切文档 fail-closed
- audit / remediation / CURRENT 认领
## 非目标
- 不修改、移动、删除或提交 `.doc/test-reports/assets/2026-09-13-document-revision-runtime-ui/`
- 不合 `dev`、不 push、不启动/重建 Docker
- 不运行或伪造真实 UI/E2E;不得声称 UI-06 已通过
- 不改 FEATURE-MATRIX 完成度;不削弱 ETag/409
## 步骤
1. [x] 从 `dev@4c465d2` 开 `fix/document-revision-editor-hydration-race`,mutex 不与现有 in_progress 冲突
2. [x] 定位全部会在弹窗打开期间替换 AST 的路径(effect / 选文档 / 重试;lease 改 deliverables 触发 effect)
3. [x] hydrate 对齐 `head_block_map` + generation token / 编辑门闩 + stale-id fail-closed
4. [x] 单测:同 map ID 稳定、缺 map 仍随机、deferred hydrate、stale id、迟到 hydrate、PATCH ETag、409
5. [x] `web` npm test / build(首轮)
6. [x] 独立审查补强:真实 PATCH 编排测试、editorDocId 绑定、关窗续跑、切文档 fail-closed
7. [ ] 真实 UI-06 重跑(本轮不做)
## 验收标准
- [x] 编辑中不因后台 hydration 换 ID 而静默丢稿(逻辑门闩 + 单测)
- [x] 找不到目标块保留编辑器并提示
- [ ] 现场 r0→r1(未跑 E2E,保持未勾选)
## 相关链接
- Audit: [../../audit/2026-09-13-document-revision-editor-hydration-race.md](../../audit/2026-09-13-document-revision-editor-hydration-race.md)
- Remediation: [../../remediation/2026-09-13-document-revision-editor-hydration-race.md](../../remediation/2026-09-13-document-revision-editor-hydration-race.md)
- 失败证据(勿提交): `.doc/test-reports/assets/2026-09-13-document-revision-runtime-ui/schema30-ui06-r-bump-noop-failure/`
## 证据 / 备注
- mutex:`document-revision-editor-hydration-race`(新 mutex,未占用 `document-revision-save-selector` 等 in_progress 行)
- 基线:`dev@4c465d2`
- 验证:补强后全量 `npm test` + `npm run build` 通过;`saveControlledBlockEdit` 断言一次 PATCH
- **未跑真实 UI-06,不得标 done**
@@ -1,54 +0,0 @@
---
title: "UI-11 快速完成观测契约"
status: done
created: 2026-09-13
updated: 2026-09-14
owner: Cursor-Auto
branch: fix/document-revision-fast-completion-observation
worktree: "-"
mutex: document-revision-fast-completion-observation
---
# UI-11 快速完成观测契约
## 目标
堵住第14轮 UI-11:助手已 `completed`,验收脚本仍硬等处理中 60s,把成功终态误判为失败。只改测试契约,不降真实性。
## 范围
- `web/src/lib/squadCompletionObservation.ts` 与单测
- `web/e2e/document-revision-runtime.spec.ts` 的 `waitForSquadCompletion`
- audit / remediation / CURRENT
## 非目标
- 不改产品运行时、不放宽上传/对应关系/终态/无错误
- 不碰证据目录;不合 dest;不启动/重启容器;不 E2E;不 push
- 不把 stub 或伪造页面当验收
## 步骤
1. [x] 从 `dev@339e871` 开分支并登记 mutex
2. [x] 观测谓词 + 直接 completed / 经历 inflight 测试
3. [x] 接线 `waitForSquadCompletion`,保留 UI-11 上传断言
4. [x] 跑相关单测并原子提交
## 验收标准
- [x] 已 completed 直接接受,不要求 inflight
- [x] 经历 inflight 再到终态仍接受
- [x] 错误终态与错位消息拒绝
- [ ] 现场 UI-11(未跑)
## 相关链接
- Audit: [../../audit/2026-09-13-document-revision-fast-completion-observation.md](../../audit/2026-09-13-document-revision-fast-completion-observation.md)
- Remediation: [../../remediation/2026-09-13-document-revision-fast-completion-observation.md](../../remediation/2026-09-13-document-revision-fast-completion-observation.md)
## 证据 / 备注
- mutex:`document-revision-fast-completion-observation`(新 mutex)
- 基线:`dev@339e871`
- 验证:`npx tsx --test src/lib/squadCompletionObservation.test.ts` PASS;`cd web && npm test` PASS(306 + 29)
- **未跑真实 UI-11,不得标 done**;**不得 merge / rebuild / E2E / push**
@@ -1,61 +0,0 @@
---
title: "文档修改、版本差异与智能体变更说明设计"
status: done
created: 2026-09-13
updated: 2026-09-13
owner: Codex
branch: feature/document-revision-management
worktree: "-"
mutex: docgov
---
# 文档修改、版本差异与智能体变更说明设计
## 目标
基于当前 DocGov、任务、块编辑器与通知实现,形成一套可直接评审和拆分实施的文档修改管理方案,覆盖人工修改标记、智能体/小队修改归属、版本边界、任意版本比较、AI 变更说明及负责人通知。
## 范围
- 交叉核对现有文档数据模型、保存链路、Agent 产物落盘、前端块编辑器、权限和通知机制。
- 明确定义“智能体基线 + 后续人工修改”的工作副本与正式版本语义。
- 设计数据模型、事务边界、API、前端交互、通知、权限、迁移兼容及验收矩阵。
- 产出 audit、system-design、remediation 文档并同步文档索引与 FEATURE-MATRIX。
## 非目标
- 本任务不修改业务代码、数据库迁移或运行环境。
- 本任务不执行共享容器重建、真实 PI E2E 或合入 `dev`。
- 本任务不替用户决定版本保留周期、强监管电子签名策略等产品决策;方案给出推荐默认值和决策点。
## 步骤
1. [x] 完成当前实现与既有设计的证据核对。
2. [x] 形成领域模型、版本状态机与一致性边界设计。
3. [x] 形成前端展示、API、权限、通知与验收设计。
4. [x] 形成分波次整改方案和实施任务拆分。
5. [x] 更新文档索引、FEATURE-MATRIX、CURRENT 并执行文档质量检查。
## 验收标准
- [ ] 方案能逐条映射用户提出的版本边界与显示规则。
- [ ] 能区分用户、单智能体、智能体小队及系统迁移等修改主体。
- [ ] 并发、失败恢复、权限、审计、通知去重和大文档性能均有确定性方案。
- [ ] API、表结构、UI 状态、迁移顺序与测试用例足以供开发直接拆单。
- [ ] 仅产生方案文档变更,无业务代码和环境变更。
## 相关链接
- Audit: `../../audit/2026-09-13-document-revision-management-gap-analysis.md`
- System design: `../../system-design/document-revision-management.md`
- Remediation: `../../remediation/2026-09-13-document-revision-management-implementation-plan.md`
- Test report: 实施阶段补充
## 证据 / 备注
- 用户评审通过前保持 `in_progress`;本轮交付的是可评审方案,不代表能力已实现。
- 2026-09-13:`git diff --check` PASS;新增文档及新增链接均可解析。
- 索引文件中另有 3 个与本任务无关的既有失效链接(两个历史 `.tmp` 目录、一个 `architecture-design.md` 相对路径),本任务未扩大范围修改。
- 2026-09-13:独立复审(Cline)通过,结论待用户最终拍板:①三项决策(智能体/模板开 Version、high/critical 强制编制负责人二次确认、首发只覆盖受控文档)均确认可行,理由与既有 `document_change_proposals` 认领授权机制一致;②抽查 DOCREV-01~09 全部 9 项源码证据属实(含 `bizdev/service.go:499-502` 通用提案文案、`:694-705` 忽略错误写哈希、`handlers.go:1027` 客户端 holder 直通、`BlockEditorModal.tsx:104` 硬编码“张工”、`saveDocumentContent` 无调用者、Goose 基线 00027);③补强 2 处设计缺口——根表指针列与既有 `freeform_documents.current_version_id` 同名冲突(改为 `ledger_*` 命名并明确旧列退役)、状态机把文档生命周期误并入版本状态(已拆为正交状态图);同步修订 system-design §4/§6.7、remediation §3/§5.2/§5.7。
- 2026-09-13:用户确认 DOCREV 实施计划选项 1;设计任务归档,进入 Wave 0。
@@ -1,57 +0,0 @@
---
title: "文档账本 PG ID 与计数器重映射"
status: done
created: 2026-09-13
updated: 2026-09-14
owner: Cursor-Auto
branch: fix/document-revision-pg-id-remap
worktree: "-"
mutex: document-revision
---
# 文档账本 PG ID 与计数器重映射
## 目标
堵住 schema31-round19:首次生成 PG 已写入 snapshot/version/candidate,但 `CommitAgentVersion` 因内存 map 误删 baseline 而 `not found`。
## 范围
- `internal/docrevision` ID 分配、adopt、PG persist
- 确定性单测 + 隔离 PG 回归
- audit / remediation / CURRENT / FEATURE-MATRIX / gap-matrix
## 非目标
- 本任务编码阶段不 merge / 不启停容器 / 不 push;Round20 验收见运行时 UI 报告
- 不删不改证据目录
- 不忽略 `ErrNotFound`,不伪造基线/报告
## 步骤
1. [x] 从 `dev@fa6a033` 开分支并登记 mutex
2. [x] 独立验证 openTemplate 不推进 counter + 无条件 delete 误删
3. [x] 统一 helper + 全路径 adopt
4. [x] `gofmt` / `go vet` / `go test -short` / 相关包测试
5. [x] 原子提交
## 验收标准
- [x] 占用 ID 不覆盖;adopt 只删同一对象
- [x] 高序列首次生成:自动提交、V2、candidate committed、baseline 未丢、重启 hydration
- [x] 现场 UI-03:Round20 项目 6159 首次生成 V2/r0,任务 `run_1789343479579646533` 成功(相对 6158 candidate id=175 / output snapshot 250 的 not found)
## 相关链接
- Audit: [../../audit/2026-09-13-document-revision-pg-id-remap.md](../../audit/2026-09-13-document-revision-pg-id-remap.md)
- Remediation: [../../remediation/2026-09-13-document-revision-pg-id-remap.md](../../remediation/2026-09-13-document-revision-pg-id-remap.md)
- Checklist: [../checklists/2026-09-13-document-revision-pg-id-remap.md](checklists/2026-09-13-document-revision-pg-id-remap.md)
- Handoff: [../handoffs/2026-09-13-document-revision-pg-id-remap.md](handoffs/2026-09-13-document-revision-pg-id-remap.md)
## 证据 / 备注
- 基线:`dev@fa6a033`
- 验证:`gofmt`/`go vet` PASS;`go test -short ./...` PASS;隔离临时库 `HighSequenceFirstGen` PASS(拒绝 `agent_system_dev`,测完 DROP)
- 失败归档(只读):`.doc/test-reports/assets/2026-09-13-document-revision-runtime-ui/schema31-round19-ui03-advisor-briefing-docrevision-not-found/`
- 验收:Round20 UI-03 PASS,见 [../../test-reports/2026-09-14-document-revision-runtime-ui-test-report.md](../../test-reports/2026-09-14-document-revision-runtime-ui-test-report.md)
- 工程修复已合入 `dev@b258ab8`
@@ -1,56 +0,0 @@
---
title: "post-restart 期望正文须为最终持久 marker"
status: done
created: 2026-09-13
updated: 2026-09-14
owner: Cursor-Auto
branch: fix/document-revision-post-restart-final-snippet
worktree: "-"
mutex: document-revision-post-restart-final-snippet
---
# post-restart 期望正文须为最终持久 marker
## 目标
第二次 post-restart 已恢复 login/项目/文档/`revision-state` 200/`V3`/`r2`/正文,但 `phase-state.bodySnippet` 仍是 UI-06 marker,断言旧文失败。UI-13b A1 成功保存后须把最终持久正文写入 phase-state;不得放宽 post body 断言。
## 范围
- `web/src/lib/durableBodySnippet.ts` 纯函数契约
- UI-06 / UI-13b / UI-15-pre 同步 `latestDurableBodySnippet` → `phase-state.bodySnippet`
- audit / checklist / handoff / CURRENT
## 非目标
- 不改生产业务代码、不重跑真实 UI、不动容器、不 merge、不 push
- 不改删 assets
- 不改删历史失败 assets;不声称全仓 `production_ready=yes`
## 步骤
1. [x] 从 `dev@eb85b8a` 认领分支并登记 mutex
2. [x] 成功修订覆盖旧 snippet;冲突失败稿不成为期望正文
3. [x] UI-13b 完成后与 UI-15-pre 写入最终 marker
4. [x] `npm test` / `npm run build`
5. [x] 原子提交
6. [x] Round20 `UI_PHASE=post-restart` PASS(V3/r2 / `A1-win-mu0gwiez`)
## 验收标准
- [x] 契约测试:A1 覆盖 UI06;A2 conflict 不覆盖 A1
- [x] post-restart 仍断言 `st.bodySnippet` 可见
- [x] 真实 UI-15 post-restart:Round20 1 passed / 18 skipped;页面恢复 V3/r2/正文
## 相关链接
- Audit: [../../audit/2026-09-13-document-revision-post-restart-final-snippet.md](../../audit/2026-09-13-document-revision-post-restart-final-snippet.md)
- Checklist: [../checklists/2026-09-13-document-revision-post-restart-final-snippet.md](checklists/2026-09-13-document-revision-post-restart-final-snippet.md)
- Handoff: [../handoffs/2026-09-13-document-revision-post-restart-final-snippet.md](handoffs/2026-09-13-document-revision-post-restart-final-snippet.md)
## 证据 / 备注
- 基线:`dev@eb85b8a`
- 失败归档(只读):`.doc/test-reports/assets/2026-09-13-document-revision-runtime-ui/schema31-postrestart-stale-body-snippet-failure/`(当时 `bodySnippet=UI06-mu0eq020`)
- Round20 `phase-state`:`versionText=V3` `revisionText=r2` `bodySnippet=A1-win-mu0gwiez`
- 报告:[../../test-reports/2026-09-14-document-revision-runtime-ui-test-report.md](../../test-reports/2026-09-14-document-revision-runtime-ui-test-report.md)
@@ -1,59 +0,0 @@
---
title: "post-restart 项目名 selector 与阶段产物隔离"
status: done
created: 2026-09-13
updated: 2026-09-14
owner: Cursor-Auto
branch: fix/document-revision-post-restart-selector
worktree: "-"
mutex: document-revision-post-restart-selector
---
# post-restart 项目名 selector 与阶段产物隔离
## 目标
第18轮 main 18 PASS 后,post-restart 在页面已恢复项目时因项目名同时出现在顶栏与侧栏而 strict violation。改为 banner 内唯一 exact 断言,点击仍走可见项目入口;Playwright output/report 与结果 JSON 按 `UI_PHASE` 分离(main 仍用 `ui-acceptance-results.json`)。
## 范围
- `web/e2e/document-revision-runtime.spec.ts` post-restart 项目恢复断言
- `web/src/lib/currentProjectRestore.ts` 与契约测试
- `web/playwright.config.ts` + `playwrightPhaseArtifacts` 按阶段分目录
- audit / checklist / handoff / CURRENT
## 非目标
- 不改业务逻辑、不重跑真实 UI、不动容器、不 merge、不 push
- 不改删 `.doc/test-reports/assets/` 证据
- 不声称 post-restart / UI-15 通过
## 步骤
1. [x] 从 `dev@b824948` 认领分支并登记 mutex
2. [x] 项目入口 click + banner exact 断言;禁 `.first()` 弱化
3. [x] `UI_PHASE` 分离 `playwright-output-*` / `playwright-report-*`
4. [x] 结果 JSON:main 保持 `ui-acceptance-results.json`;post-restart 写 `ui-acceptance-results-post-restart.json`
5. [x] `npm test` / `npm run build`
6. [x] 原子提交
7. [ ] 占槽后重跑 post-restart(本轮不做)
## 验收标准
- [x] 页面级 `getByText(项目名)` 在 2 命中时契约判定失败
- [x] 入口为 complementary exact title;当前项目为 banner exact text
- [x] main / post-restart 产物目录不同
- [x] post-restart `recordPass` 不覆盖 main 的 `ui-acceptance-results.json`
- [ ] 真实 UI-15 post-restart(未跑)
## 相关链接
- Audit: [../../audit/2026-09-13-document-revision-post-restart-selector.md](../../audit/2026-09-13-document-revision-post-restart-selector.md)
- Checklist: [../checklists/2026-09-13-document-revision-post-restart-selector.md](checklists/2026-09-13-document-revision-post-restart-selector.md)
- Handoff: [../handoffs/2026-09-13-document-revision-post-restart-selector.md](handoffs/2026-09-13-document-revision-post-restart-selector.md)
## 证据 / 备注
- 基线:`dev@b824948`
- 失败归档(只读):`.doc/test-reports/assets/2026-09-13-document-revision-runtime-ui/schema31-postrestart-project-title-selector-failure/`
- **未跑真实 post-restart,不得标 done**
@@ -1,62 +0,0 @@
---
title: "prelim_design 缺 output.md 产物契约修复"
status: done
created: 2026-09-13
updated: 2026-09-14
owner: Cursor-Auto
branch: fix/document-revision-pi-runner-module
worktree: "-"
mutex: document-revision-prelim-output
---
# prelim_design 缺 output.md 产物契约修复
## 目标
第11轮 UI-11:202 + `prelim_design` 已正确,但 `step_01_draft` 缺真实 `output.md`。embed 官方模板、归一化 runner 路径、缺产物 fail-closed;对「进程 0 + settled failure / 缺产物」的**瞬时**失败做有界全新 step 重试。不得标 `done`。
## 范围
- `internal/template` embed + loader
- `internal/agent` 路径映射、目标强制、瞬时/永久分类、`Result.Retryable`
- `internal/squad` `runOneStep` 有界全新 invocation
- `deploy/pi-agent/runner.mjs` + `settle-policy.mjs`
- `deploy/pi-agent/Dockerfile` 必须 COPY runner 的全部相对 import 到 `/app`
- `deploy/app/Dockerfile` `COPY templates` / `COPY configs` 到 `/app`;`.dockerignore` 放行官方 markdown
- Docker build context / `/app/templates/docs` 读路径实测(不执行 env-service 重建)
- 文档:audit / remediation / CURRENT
## 非目标
- 不伪造 `output.md`;不执行截断 `write` 参数;不改 E2E prompt;不放宽缺失校验
- 不触碰/提交证据目录;不执行 env-service 重建/重启;本轮不重跑 E2E
- 不改 FEATURE-MATRIX;不合 `dev`;不 push
- 不对永久缺失(干净 settle 后无产物、`prompt_empty`、治理)无限重试
## 步骤
1. [x] 从 `dev@2a58674` 开 `fix/document-revision-prelim-output` 并认领 mutex
2. [x] 定位:stub 模板 + `agent_settled` 假成功 + 只认精确 `output.md` 键
3. [x] embed / 映射 / runner fail-closed + 单测 + 门禁
4. [x] 纳入现场时序:write 已流出但 `terminated`;SDK retry 1–3 Connection error;`auto_retry_end success=false`;仍 `agent_settled`;trace `success=true`
5. [x] settle-policy + Go 分类 + `runOneStep` 有界全新重试 + 单测
6. [x] `.dockerignore` 放行 `templates/**/*.md`;Docker context 实测 `/app/templates/docs/prelim_design.md`
7. [x] 本次写入的目标不覆盖、不再调用;backend 明确失败仍 FAIL(不把文件存在当成功);上一轮残留不当成功
8. [x] `dev@55a4f39` 重建后 runner `ERR_MODULE_NOT_FOUND settle-policy.mjs`:Dockerfile COPY 齐相对模块 + COPY 契约测试
9. [ ] 占槽后真实 UI 重跑(本轮不做)
## 验收标准
- [ ] 无盘模板时 `prelim_design` 仍为官方「系统初步设计方案」
- [ ] 绝对/`./`/重复子目录 `rel_path` 能落到目标文件
- [ ] `ok:true` 但无非空目标 → 失败,不发明正文
- [x] 瞬时 settled failure → 最多一次全新 step;永久缺失不重试;耗尽 fail-closed
- [x] pi-agent 镜像 COPY 含 runner 全部相对 import(含 `settle-policy.mjs`)
- [ ] intake 工作流单测仍绿
- [ ] 真实 UI-11 PASS 后才可标 `done`
## 相关链接
- Audit: [../../audit/2026-09-13-document-revision-prelim-output.md](../../audit/2026-09-13-document-revision-prelim-output.md)
- Remediation: [../../remediation/2026-09-13-document-revision-prelim-output.md](../../remediation/2026-09-13-document-revision-prelim-output.md)
- Evidence: [../../test-reports/assets/2026-09-13-document-revision-runtime-ui/schema30-ui11-prelim-design-missing-output-failure](../../test-reports/assets/2026-09-13-document-revision-runtime-ui/schema30-ui11-prelim-design-missing-output-failure)
@@ -1,46 +0,0 @@
---
title: "质量门禁:行动计划表状态「待续」窄豁免"
status: done
created: 2026-09-13
updated: 2026-09-14
owner: Cursor-Auto
branch: fix/document-revision-quality-context
worktree: "-"
mutex: docgov
---
# 质量门禁:行动计划表状态「待续」窄豁免
## 目标
结构化行动计划表中独立状态单元格「待续」不再误报;正文/标题/列表/普通表中的「待续」仍 FAIL。禁词表不得删除「待续」。
## 范围
- `internal/squad/quality_gate.go` 窄 Markdown 表结构识别
- 敌意单测 + 既有自检豁免 / 投影 / repair 隔离不回归
- 文档:audit / gap-matrix / CURRENT / FEATURE-MATRIX
## 非目标
- 不删除「待续」禁词;不放宽普通正文/任意同行表格
- 不触碰 assets / E2E;不操作容器
## 步骤
1. [x] 认领 CURRENT;写 audit/short-term
2. [x] 仅豁免行动计划表「阶段/状态/进度」列独立单元格(去粗体精确等于「待续」+ 表头列索引对齐 + 实质行动 + 负责/触发完整)
3. [x] 敌意用例:正文「后续章节待续」、`| 内容 | 待续 |`、待续说明、残行/空动作、负责方/触发=待续仍 FAIL;列重排仅状态列可 PASS
4. [x] 门禁 + 原子提交
## 验收标准
- [x] 现场同构行动表 PASS,且不触发 repair
- [x] 敌意上下文仍记录 `待续`
- [x] `ProhibitedPhrases` 仍含「待续」
- [x] targeted / `go vet` / `go test -short` / `go test -race ./internal/taskrun` / web test+build / `git diff --check`
## 相关链接
- Audit: [../../audit/2026-09-13-document-revision-quality-status-false-positive.md](../../audit/2026-09-13-document-revision-quality-status-false-positive.md)
- Evidence: [../../test-reports/assets/2026-09-13-document-revision-runtime-ui/schema30-ui03-quality-status-false-positive](../../test-reports/assets/2026-09-13-document-revision-runtime-ui/schema30-ui03-quality-status-false-positive)
@@ -1,57 +0,0 @@
---
title: "质量修复子工作区契约"
status: done
created: 2026-09-13
updated: 2026-09-14
owner: Cursor-Auto
branch: fix/document-revision-quality-repair-workspace-contract
worktree: "-"
mutex: document-revision-quality-repair-workspace-contract
---
# 质量修复子工作区契约
## 目标
堵住第13轮 UI-03:repair 步 TASK 引导 `../../output.md`,模型越界改根文件,本地目标缺失导致 `quality_failed` 停在 70。门禁判定保持,修复契约改为本地快照 + containment。
## 范围
- `internal/squad/repair_workspace.go` 与单测
- `EnsureQualityOrRepair` / `buildSubWorkspaces` snapshot 布局
- audit / remediation / CURRENT
## 非目标
- 不放宽必填章节;不把越界根文件当成功;不隐藏 `quality_failed`
- 不改默认步骤的 `../../` context 导航
- 不碰证据目录;不合 dev;不 rebuild Docker;不 E2E;不 push
## 步骤
1. [x] 从 `dev@8b1a531` 开分支并登记 mutex
2. [x] 快照契约 + containment + 测试
3. [x] 独立审查 fail-open:`runErr` / containment 不得提升;restore 失败硬返回;创建/删除计入 mutation
4. [x] gofmt / vet / `go test -short ./...` / `-race` squad+agent / settle-policy.test.mjs / `git diff --check`
5. [ ] 真实 UI-03(本轮不做)
## 验收标准
- [x] 仅 `runErr==nil` ∧ 无 containment ∧ `TrustedLocalDeliverable=true` 才覆盖根并重验
- [x] 越界(含创建/删除受保护父级)恢复后不提升,报告 FAIL
- [x] backend 失败/超时即使留下本地目标也不提升
- [x] restore 失败立即返回,可测策略能断言错误传播
- [ ] 现场 UI-03(未跑)
## 相关链接
- Audit: [../../audit/2026-09-13-document-revision-quality-repair-workspace-contract.md](../../audit/2026-09-13-document-revision-quality-repair-workspace-contract.md)
- Remediation: [../../remediation/2026-09-13-document-revision-quality-repair-workspace-contract.md](../../remediation/2026-09-13-document-revision-quality-repair-workspace-contract.md)
## 证据 / 备注
- mutex:`document-revision-quality-repair-workspace-contract`(新 mutex,不与现有 in_progress 冲突)
- 基线:`dev@8b1a531`
- 验证(fail-closed 追加):`gofmt` / `go vet ./...` / `go test -short ./...` / `go test -short -race ./internal/squad/ ./internal/agent/` / `node --test deploy/pi-agent/settle-policy.test.mjs` / `git diff --check` PASS
- 保护范围仅 `output.md` / `template.md` / `blackboard.json`;其它父级文件是剩余风险
- **未跑真实 UI-03,不得标 done**;**不得 merge / rebuild / E2E / push**
@@ -1,68 +0,0 @@
---
title: "项目 reviewer 同步到受控文档职责"
status: done
created: 2026-09-13
updated: 2026-09-14
owner: Cursor-Auto
branch: fix/document-revision-reviewer-duty-sync
worktree: "-"
mutex: document-revision-reviewer-duty-sync
---
# 项目 reviewer 同步到受控文档职责
## 目标
堵住第17轮 UI-13a:UI-01 已把 USER_B 设为 reviewer,但 `doc_proj6145_intake` 矩阵为 viewer。项目创建时的 reviewer 必须成为后续每份受控文档的权威 `reviewerId`。
## 范围
- `project_members.document_duty` 迁移与成员 upsert
- 任务生成/账本创建解析项目职责;禁止硬编码 2/3
- 已有文档缺失/非成员占位的服务端自愈
- 前端立项 persist `document_duty` + 职责互斥
- audit / remediation / CURRENT
## 非目标
- 不 merge、不启停/重建容器、不跑/声称真实 UI E2E、不 push
- 不删不改证据目录
- 不向用户索要 token;不提交账号密码
## 步骤
1. [x] 从 `dev@639969f` 开分支并登记 mutex
2. [x] RED/GREEN:解析、自愈、成员 duty、前端映射
3. [x] `gofmt` / `go vet` / `go test -short` / 相关 `-race` / `npm test` / `npm run build`
4. [x] 原子提交
5. [x] 独立审查收紧(暂不合入):Heal 以 assigned 为权威;成员变更带 duty 并同步文档;缺 role 不降 owner;写权精确断言;迁移多 owner 确定回填;并发 upsert PG 用例;自愈失败不假成功
6. [x] 最后一轮:移出成员 sync + 前端刷新;空 assigned 只清失效 holder;显式 revoke 再 heal;账本创建失败不成功
7. [x] 补充审查:lock + 读旧/冲突 holder + 成员写 + 精确清槽同事务;提交后 heal;失败仍 `ERR_DUTY_SYNC`
8. [x] Heal 与成员写共用 `pg_advisory_xact_lock(project_id)`;解析与文档读写同事务;确定性并发 PG 证明旧 reviewer 不复活
## 验收标准
- [x] A=author、B=reviewer、C=none;第二文档继承;重复执行幂等;旧文档缺失回填
- [x] 服务端写操作仍按权限拒绝
- [x] 前端不按名字提升
- [ ] 现场 UI-13a(未跑)
## 相关链接
- Audit: [../../audit/2026-09-13-document-revision-reviewer-duty-sync.md](../../audit/2026-09-13-document-revision-reviewer-duty-sync.md)
- Remediation: [../../remediation/2026-09-13-document-revision-reviewer-duty-sync.md](../../remediation/2026-09-13-document-revision-reviewer-duty-sync.md)
- Checklist: [../checklists/2026-09-13-document-revision-reviewer-duty-sync.md](checklists/2026-09-13-document-revision-reviewer-duty-sync.md)
- Handoff: [../handoffs/2026-09-13-document-revision-reviewer-duty-sync.md](handoffs/2026-09-13-document-revision-reviewer-duty-sync.md)
## 证据 / 备注
- mutex:`document-revision-reviewer-duty-sync`(新 mutex,不占用已有 in_progress)
- 基线:`dev@639969f`
- 证据(只读):`.doc/test-reports/assets/2026-09-13-document-revision-runtime-ui/schema30-ui13a-reviewer-duty-sync-failure/`
- 验证(原子清槽轮):`gofmt`/`go vet` PASS;`go test -short ./...` PASS;相关 `-race` PASS;`npm test`/`build` PASS;隔离 PG PASS
- 原子性:成员写与 `HealProjectDocuments` 均先 `pg_advisory_xact_lock(project_id)`,再在同一事务内读成员/文档并更新;旧 heal 不能在转移提交后把 reviewer A 写回
- PG 集成已写 heal/空 assigned/多 owner 回填/并发 upsert;`-short` 或无 `TEST_DATABASE_URL` 时跳过
- 隔离跑法:`scripts/run-isolated-duty-sync-pg-tests.sh`(`TEST_DATABASE_URL` 或 `PG_ADMIN_URL` 建临时库)。拒绝 `agent_system_dev`
- 本轮已在已运行的 context Postgres 上 `CREATE DATABASE agent_duty_sync_itest_*`,串行跑通后 `DROP`;未 `env-service`、未动共享库数据
- **兼容**:旧二进制不读 `document_duty` 仍可运行;新代码在 assigned 为空时不臆造 reviewer。6145 的 B 仍是空 duty,须再走成员 API
- **未跑真实 UI-13a,不得标 done**;**不得 merge / 启停容器 / E2E / push**
@@ -1,107 +0,0 @@
---
title: "文档版本账本运行时整改"
status: done
created: 2026-09-13
updated: 2026-09-14
owner: Cursor-Auto
branch: fix/document-revision-runtime-ui03
worktree: "-"
mutex: docgov
---
# 文档版本账本运行时整改
## 目标
消除 revision-state 404、重启丢账本、人工保存无效、overlay 无效;接通首轮/二轮可见确定性 change report;PATCH 权限→账本→投影顺序正确;停在 fix 分支待集成。
## 范围
- `internal/docrevision` PG hydrate/persist + bootstrap + `MaterializeAgentOutput`
- `internal/server` 授权、PATCH 顺序、orphan 不静默建账
- `internal/bizdev` 小队成功走 Materialize(禁止仅 OpenTemplate)
- `cmd/document-revision-backfill` gofmt
- `web` 保存链路与 overlay 三模式
- 工程测试 + 扩展 UI 验收计划(分栏)
## 非目标
- 不占 CURRENT 集成槽、不 `env-service rebuild`、不 push、不 merge `dev`
- 不伪造 PI 叙事 change report;不把 fallback 说成完整 PI 分析
- 不把 stub 输出写入最终用户验收报告
## 步骤
1. [x] 审计 / 整改 / 本任务 + CURRENT 认领
2. [x] 分支 `fix/document-revision-runtime`
3. [x] PG store + bootstrap + backfill
4. [x] Handler / agent / 前端
5. [x] 首轮报告 Materialize + PATCH 顺序 + 单测
6. [x] gofmt + UI checklist 扩展 + 文档证据
7. [x] 分层 commit,输出哈希与剩余 blocker(不 merge/push)
## 验收标准
- [x] 工程门禁与 UI 实战计划分栏
- [x] Round20 真实 UI **PASS**(见 [../../test-reports/2026-09-14-document-revision-runtime-ui-test-report.md](../../test-reports/2026-09-14-document-revision-runtime-ui-test-report.md))
- [x] 剩余开放:PI 叙事仍为 fallback;orphan 禁止假 V1(UI-16 验证已注册路径);不可用假数据掩盖
## 相关链接
- Audit: [../../audit/2026-09-13-document-revision-runtime-404.md](../../audit/2026-09-13-document-revision-runtime-404.md)
- Remediation: [../../remediation/2026-09-13-document-revision-runtime-remediation.md](../../remediation/2026-09-13-document-revision-runtime-remediation.md)
- Checklist/UI: [../checklists/2026-09-13-document-revision-runtime-ui-acceptance.md](checklists/2026-09-13-document-revision-runtime-ui-acceptance.md)
## 证据 / 备注
### 工程门禁(非 UI 验收)
```text
gofmt -l cmd/document-revision-backfill/main.go internal/docrevision/risk.go
go vet ./...
go test -short ./...
cd web && npm test && npm run build
```
本轮门禁(2026-09-13 10:11 UTC 独立复跑):`go vet ./...` PASS;`go test -short ./... -count=1` PASS(含 Materialize 首/二轮 change_report_id、PATCH 顺序、Materialize 失败透出、Assert 先职责后租约、SaveDocumentContent 审计、pending 事实源不越权、同步/异步待确认文案、完成活动仅 committed、pending 活动标明待确认、MarkProposalApplied 失败显式可重试);`web npm test` 199+27 PASS;`npm run build` PASS。使用 dev PostgreSQL(schema 28)执行 `TestPGPersistSurvivesNewServiceInstance` PASS,证明新 Service 实例可恢复账本。上述均为工程门禁,不能替代 UI 验收。
UI-01 目录同步补丁门禁(2026-09-13):`node --test adminUserDirectorySync.test.ts` 3 PASS;`web npm test` 219+27 PASS;`npm run build` PASS;`go vet ./...` + `go test -short ./...` PASS。未提交 `web/e2e/*` 与 `test-reports/assets/`。
UI-01/02 访问与成员落库门禁(2026-09-13):`go test ./internal/projectinstance -short` PASS;`TEST_DATABASE_URL=… go test ./internal/projectinstance -run TestPG_GoverningAccess` PASS;`TEST_DATABASE_URL=… go test ./internal/server -run TestChatProjectAccess` PASS;`go vet ./...` + `go test -short ./...`;`web npm test` + `npm run build`。未提交 e2e/assets。
复核补强(同日):
- A:`MaterializeAgentOutput` 错误写入 `TaskRunResult.Success=false` + `ErrorReason`,不再空白忽略
- B:cand 非空且 report invalid/unassessed 时禁止自动提交(候选标 needs_confirmation)
- C:`AssertHumanCanEdit` 先职责/生命周期再租约;受控投影改 `SaveDocumentContent` 保留 author_last_edited/审计;失败 `DOCUMENT_PROJECTION_FAILED` 可幂等重试
- D:ChangeReportPanel 完整展示风险条目/项目影响/文档影响建议/开放问题;加载失败显式错误
- E:revision-state 暴露 `pending_candidate_id` / `pending_change_report_id` / `pending_risk_level` + `can_decide_pending`;工具条「待确认报告」确认/拒绝调 decision API(不绕过确认)
- F:**高风险事实源门禁**:Materialize 后仅 committed 才 MarkDocumentContentUpdated / MarkProposalApplied;`needs_confirmation` 立即 `ProjectOutputMarkdown` 恢复 ledger head,候选仅留 immutable blob;decision=commit 投影后再 Mark;decision=reject 保持旧 head;投影失败显式错误
- G:**对话可见状态**:`TaskRunResult` 带 `pending_agent_candidate_id` / report / risk;`RequiresAuthorApproval` 可复用但用 `PendingProposal` vs `PendingAgentCandidateID` 区分 DocGov 提案;terminal=`pending_author_confirmation`;同步 coordinator 与异步 `CompletionSummary` 显示「文档候选已生成,待编制人确认」+ artifact 元数据;确认并投影后才「已完成」
- H:**活动与提案收口**:`RecordActivity(完成交付物)` 仅在 committed 投影成功后;pending 记「候选待编制人确认」;落盘/投影失败不记完成。`MarkProposalApplied` 失败返回显式错误(bizdev / `DOCUMENT_GOVERNANCE_FAILED`)可重试
- I:**阶段链防传播**:`ExecuteStage` 遇 `PendingAgentCandidateID` 立即停阶段(Success=false + 待确认文案),SubArtifacts 保留候选,**不**吸收 ExtractedData / PriorDoc;确认后由用户重新发起阶段
- J:**前端历史映射**:`pending_author_confirmation` 显式映射为气泡状态(不再默认 completed);刷新窗口显示「待编制人确认」标签
- K:**决策幂等收口**:`CommitAgentVersion` 已 committed 且 expected hashes 一致时返回当前 state(可继续投影/MarkProposalApplied);已 committed 禁止 reject。`MarkProposalApplied` 先写 DB 再改内存;已 applied 幂等(包内 Propose+Decide 验证)。decision 失败 hint 指向同决策重试;**不**暴露内存补种 helper(避免内存/DB 分叉)
- L:**Playwright 骨架**:`web` 增加 `@playwright/test` + `playwright.config.ts` + `e2e/document-revision-runtime.spec.ts`(`RUN_UI_ACCEPTANCE=1` 才跑;无 mock/route/API/DB fixture)
- M:**上传注册事实源**:发送前 `await registerUploadAttachments` → `POST /api/v1/freeform-documents`(`client_key` 幂等);失败 UI 显式错误且不发消息、不生成本地 `doc-upload` orphan;成功使用 `doc-free-*` 写入 deliverable/fileStore 并挂 toolbar
- N:**Auth 契约映射(UI-00 实战)**:Go `UserAccount` 为 snake_case;前端在 API 边界 `mapUserAccount`/`mapLoginResult`/`mapMeResult` 统一转 camelCase(login/me/admin users/create/role/status);`BootstrapAdminFromConfig` 的 `UpdateUserRole` 错误不再静默。详见 [../../audit/2026-09-13-auth-useraccount-snake-case-mapping.md](../../audit/2026-09-13-auth-useraccount-snake-case-mapping.md)
- O:**全局用户目录同步(UI-01 实战)**:管理员创建/角色/状态成功后必须经 `syncAdminUserDirectories` 调用父级 `onRefreshUsers`(禁止死 prop / 静默 catch);同浏览器立项候选可立即看到新账号。跨设备/清缓存缺口见 audit 残留风险,**不**下放 admin users API。详见 [../../audit/2026-09-13-admin-user-directory-sync-ui01.md](../../audit/2026-09-13-admin-user-directory-sync-ui01.md)
- P:**无 live 访问 + chat 项目门禁 + 立项成员落库(UI-01/02)**:`GetGoverningInstanceForAccess` 区分从未激活 vs completed/terminated;chat/chatStream 先 `RequireProjectAccess` 再 stage(SSE 拒绝不得先 200);`createProject` 后持久化非创建者成员。详见 [../../audit/2026-09-13-workflow-access-chat-members-ui01-02.md](../../audit/2026-09-13-workflow-access-chat-members-ui01-02.md)
- Q:**立项确认双击竞态**:`handleCreateProjectConfirm` 加同步 in-flight `useRef` 锁 + `createProjectBootstrapIdRef`(取代 state);`createProjectSubmitting`/`submitPhase` 驱动 Modal「立项中/同步成员中」、禁用确认与关闭;失败可串行幂等重试,成功清 bootstrap。证据:`createProjectSubmitGuard.test.ts`
- R:**UI-02 任务作用域契约**:`ResolveMessageScopeForTask` 三态(preactivation / live stage / closed→Err);handler 无 live 创建 202 非 409;E2E UI-02 以 `POST /api/v1/tasks/runs` 2xx 为硬门禁(409/连接异常 FAIL)。证据:`message_scope_test.go`、`TestCreateTaskRun_PreActivationAcceptedNot409`、`document-revision-runtime.spec.ts` UI-02
- S:**UI-03 客户端同步 + 任务幂等(本分支)**:`templateMatch` intake 标记优先;任务终态后 `postTaskDeliverableSync` merge `doc_proj*`;goose `00030` 放行 `pending_author_confirmation` + `idempotency_key` 部分唯一;`ClaimRun` 先占键再写 chat;FE reconnect 同 run 订阅。审计:[../../audit/2026-09-13-controlled-doc-client-sync-ui03.md](../../audit/2026-09-13-controlled-doc-client-sync-ui03.md)。门禁:`go test -short ./internal/taskrun ./internal/server`;`web npm test` 232+27;`npm run build`。**schema30 真实现卷迁移合入前独立验证**;真实 UI-03 待占槽重跑。
### 用户 UI 实战验收
Round20 **PASS**。见 [checklist](checklists/2026-09-13-document-revision-runtime-ui-acceptance.md) 与 [test-report](../../test-reports/2026-09-14-document-revision-runtime-ui-test-report.md)。项目 6159;UI-03 V2/r0;终态 V3/r2;post-restart 恢复最终正文 `A1-win-mu0gwiez`。
### Blockers
- **DOCREV-RT-PI-NARRATIVE**(仍开放):真实 PI 业务叙事摘要/风险解释未替代确定性 fallback;Round20 已可见 fallback 字段,不得宣称为完整 PI
- **DOCREV-RT-UPLOAD-ORPHAN**(约束仍在,UI-16 PASS):仅 IndexedDB、无服务端正文 → 禁止假 V1
- **DOCREV-RT-UI-E2E**:**PASS**(Round20)
- **DOCREV-RT-SCHEMA30-VOLUME**:goose 00030 对既有重复卷的迁移仍属合入前独立验证残留
- **DOCREV-RT-USER-DIR-CROSS-DEVICE**:跨设备/新浏览器可能仍缺成员候选(本轮同浏览器未暴露)
### Commits(历史)
- `7ea686e` … `ec8a45a`(见 git log);本轮追加见会话结束提交号
@@ -1,55 +0,0 @@
---
title: "UI-11 点名优先路由 + PATCH 请求级释租"
status: done
created: 2026-09-13
updated: 2026-09-14
owner: Cursor-Auto
branch: fix/document-revision-second-doc-routing-lease
worktree: "-"
mutex: document-revision-second-doc-routing-lease
---
# UI-11 点名优先路由 + PATCH 请求级释租
## 目标
第十轮 UI-11 首错:否定句「需求」压过「系统设计输入」,且 PATCH 残留 human lease 使小队 DOC_BUSY。点名优先 + 请求级 defer 释租 + E2E 202 门闩。不得将本任务标 `done`。
## 范围
- `web/src/engine/templateMatch.ts` + 单测
- `internal/server/document_revision_handlers.go` + `document_revision_patch_order_test.go`
- `web/e2e/document-revision-runtime.spec.ts` UI-11 waiter
- 文档:audit / remediation / CURRENT
## 非目标
- 不改 E2E prompt;不改 `SaveDocumentContent` 内部释租
- 不触碰/提交 `.doc/test-reports/assets`;不操作容器;本轮不重跑 E2E
- 不改 FEATURE-MATRIX;不合 `dev`;不 push
## 步骤
1. [x] 认领 CURRENT(mutex `document-revision-second-doc-routing-lease`)
2. [x] 点名优先 +「系统设计输入」别名 + 单测
3. [x] PATCH 已授权后 defer 释租(成功 / 409 / 投影失败)+ 服务端测试
4. [x] UI-11 send 前 `tasks/runs` waiter,断言 202 后再 wait completion
5. [ ] 占槽后真实 UI 重跑(本轮不做)
## 验收标准
- [x] UI-11 原文 / 混合句 → `prelim_design`;当前文档钉住、UI-05 pin、首轮摸底仍 intake
- [x] PATCH 后无 human lease,squad 可获取
- [x] UI-11 非 202 即 fail;`requireInflight` 拒绝同步 busy
- [ ] 真实 UI-11 PASS 后才可将本任务标 `done`
## 相关链接
- Audit: [../../audit/2026-09-13-document-revision-second-doc-routing-lease.md](../../audit/2026-09-13-document-revision-second-doc-routing-lease.md)
- Remediation: [../../remediation/2026-09-13-document-revision-second-doc-routing-lease.md](../../remediation/2026-09-13-document-revision-second-doc-routing-lease.md)
- Evidence: [../../test-reports/assets/2026-09-13-document-revision-runtime-ui/schema30-ui11-second-doc-routing-human-lease-failure](../../test-reports/assets/2026-09-13-document-revision-runtime-ui/schema30-ui11-second-doc-routing-human-lease-failure)
## 证据 / 备注
- Prompt 别名「系统设计输入」≠ 卡片标题。真实 UI / 模板 / squad 标题均为「系统初步设计方案」。
- UI-11 打开第二份文档必须用已注册 `doc_proj{n}_prelim_design`(`data-doc-id`),禁止 `/设计输入|系统设计/`:既匹配不到真实标题,也容易误命中其他设计类文案或同标题模板槽。
@@ -1,57 +0,0 @@
---
title: "任务 SSE 幂等 + 质量门禁自污染与 auto_repair 产品契约"
status: done
created: 2026-09-13
updated: 2026-09-14
owner: Cursor-Auto
branch: fix/document-revision-sse-idempotency
worktree: "-"
mutex: docgov
---
# 任务 SSE 幂等 + 质量门禁自污染与 auto_repair 产品契约
## 目标
1. 同 turn 在 SSE 断线重连时返回既有 run 202、不重复聊天、不误 409 DOC_BUSY;长任务 events SSE 不被 120s WriteTimeout 切断;前端 EOF 按 after_seq 重订阅同一 run。
2. 受控文档小队任务质量门禁:**服务端启用修复预算**;否定性自检引用不误报;`quality_failed` UI 保持失败且不激活未过门禁稿。
## 范围
- SSE/幂等:`task_run_handlers`、SSE write deadline、FE subscribe 重连
- 质量 A–D:`repairBudgetForSquadTask`、`quality_gate` 语境检测、prompt 去原词、Materialize/`TerminalStatus`、FE `quality_failed`、单测
- 证据:`data/dev/workspaces/bizdev/intake_1789308825666278807`(output.md:204;events seq10)
## 非目标
- 不改全局 HTTP 超时为「无超时」;不 rebuild Docker;不 push/merge;不删证据 assets
## 步骤
1. [x] 从 `dev` 开 `fix/document-revision-sse-idempotency`;CURRENT 认领
2. [x] 幂等先查 + 属主校验
3. [x] SSE write deadline + heartbeat
4. [x] FE subscribe 重连
5. [x] A 服务端修复预算产品契约
6. [x] B 门禁否定/元语境 + prompt 去原词
7. [x] C quality_failed UI/Materialize 契约
8. [x] D 真实问题单测 + 门禁回归
9. [x] E 质量失败在 SetDocumentWorkDir/Materialize 前短路(无正式投影副作用)
10. [x] 豁免收窄为同行 meta+否定紧邻/引号;handlers 阶段请求字段边界单测锁定
11. [x] ExecuteStage 质量失败停链:不吸收事实、不追加 PriorDoc
12. [x] 小队 AutoRepair/Success 语义恢复;受控修复仅在 bizdev docRec 与 HTTP 边界强制
13. [x] 补强:quality projection / 阶段停链 / 非受控不强制 repair 单测;全量 Go+Web 门禁 PASS
## 验收标准
- [x] 同 turn + 活跃租约 → 同 run 202、仅一对消息;不同 turn → 仍 409
- [x] SSE 心跳/写期限可测;FE EOF/after_seq 单测
- [x] TaskKey 任务 AutoRepair=false 仍有 DefaultMaxRepairRounds;L204 自检引用不误报;真敷衍仍 FAIL
- [x] quality_failed ≠ completed;Materialize 跳过未过门禁稿
- [x] `go test -short ./...`、`go vet`、`npm test`/`build`、`git diff --check`
## 相关链接
- Audit SSE: [../../audit/2026-09-13-document-revision-sse-idempotency.md](../../audit/2026-09-13-document-revision-sse-idempotency.md)
- Audit 质量: [../../audit/2026-09-13-document-revision-quality-gate-self-pollution.md](../../audit/2026-09-13-document-revision-quality-gate-self-pollution.md)
- Evidence: [../../test-reports/assets/2026-09-13-document-revision-runtime-ui/](../../test-reports/assets/2026-09-13-document-revision-runtime-ui/)
@@ -1,49 +0,0 @@
---
title: "DOCREV Wave 0:契约冻结"
status: done
created: 2026-09-13
updated: 2026-09-13
owner: Cursor
branch: feature/document-revision-management
worktree: "-"
mutex: docgov
---
# DOCREV Wave 0:契约冻结
## 目标
冻结 Version/Revision/Snapshot/Candidate/Report 契约、黄金 diff fixture、前后端类型与先红契约测试。
## 范围
- ADR 决策门落盘
- `internal/docrevision` 契约类型、schema、testdata、契约测试
- `web/src/features/documentRevision/types.ts`
## 非目标
- 不写生产写路径;不跑容器重建;不合入 `dev`
## 步骤
1. [ ] 写入 ADR 与决策门
2. [ ] 实现契约类型、change-report schema、黄金 fixture
3. [ ] 契约测试先红后绿(随 Wave 1 内核实现变绿)
4. [ ] 前端 types 对齐
## 验收标准
- [ ] ADR 已接受且与实施计划冻结表一致
- [ ] 黄金 diff 覆盖中文段落/表格/列表/Mermaid/移动块/no-op
- [ ] 契约测试可独立运行
## 相关链接
- ADR: `../../adr/2026-09-13-document-version-boundary.md`
- Design: `../../system-design/document-revision-management.md`
- Remediation: `../../remediation/2026-09-13-document-revision-management-implementation-plan.md`
## 证据 / 备注
实施中。
@@ -1,45 +0,0 @@
---
title: "DOCREV Wave 1–6:ledger 实施"
status: done
created: 2026-09-13
updated: 2026-09-13
owner: Cursor
branch: feature/document-revision-management
worktree: "-"
mutex: docgov
---
# DOCREV Wave 1–6:ledger 实施
## 目标
在 feature 分支交付快照内核、人工 PATCH、Agent candidate、比较 UI、通知与自由文档兼容。
## 范围
- Goose 00028、`internal/docrevision`、HTTP API、前端工具条、bizdev/freedoc/notification 接线
## 非目标
- 本任务不占集成槽位合入 `dev`;真实 PI 全链路补录另开集成窗口
## 步骤
1. [x] Wave 0 契约与 ADR
2. [x] Wave 1 迁移与内核
3. [x] Wave 2 人工编辑 API/UI
4. [x] Wave 3 Agent candidate/commit
5. [x] Wave 4 比较 UI
6. [x] Wave 5 通知
7. [x] Wave 6 自由文档兼容
## 验收标准
- [x] `go test -short ./internal/docrevision/...` PASS
- [x] 相关包回归 PASS
- [ ] 真实 PI + Playwright 双用户(集成槽位)
## 相关链接
- Test report: `../../test-reports/2026-09-13-document-revision-management-test-report.md`
- ADR: `../../adr/2026-09-13-document-version-boundary.md`
@@ -1,52 +0,0 @@
---
title: "受控文档分类导航契约"
status: done
created: 2026-09-13
updated: 2026-09-14
owner: Cursor-Auto
branch: fix/document-revision-workflow-category-navigation
worktree: "-"
mutex: document-revision-workflow-category-navigation
---
# 受控文档分类导航契约
## 目标
堵住第15轮 UI-13a:UI-11 后停在「我的私密」,未切「流程受控」就展开文档菜单,找不到 `doc_proj*_intake`。只改验收导航,不降真实性。
## 范围
- `web/src/lib/workflowCategoryNavigation.ts` 与单测
- `web/e2e/document-revision-runtime.spec.ts` 三个 opener
- audit / remediation / CURRENT
## 非目标
- 不改产品分类状态机;不用 API/内存规避 UI
- 不碰证据;不合 dest;不启停容器;不 E2E;不 push
## 步骤
1. [x] 从 `dev@48a4dcb` 开分支并登记 mutex
2. [x] 导航谓词 + private→workflow / 缺失 fail-closed 测试
3. [x] 三个 opener 先真实切分类
4. [x] `npm test` + `npm run build` 并原子提交
## 验收标准
- [x] 从私密分类可恢复到精确受控文档
- [x] 目标缺失 fail-closed
- [ ] 现场 UI-13a(未跑)
## 相关链接
- Audit: [../../audit/2026-09-13-document-revision-workflow-category-navigation.md](../../audit/2026-09-13-document-revision-workflow-category-navigation.md)
- Remediation: [../../remediation/2026-09-13-document-revision-workflow-category-navigation.md](../../remediation/2026-09-13-document-revision-workflow-category-navigation.md)
## 证据 / 备注
- mutex:`document-revision-workflow-category-navigation`(新 mutex)
- 基线:`dev@48a4dcb`
- 验证:`npx tsx --test src/lib/workflowCategoryNavigation.test.ts` PASS;`cd web && npm test` PASS(309 + 29);`npm run build` PASS
- **未跑真实 UI-13a,不得标 done**;**不得 merge / 启停容器 / E2E / push**
@@ -1,22 +0,0 @@
# Git 历史史诗重组执行记录
**日期**: 2026-09-13
**status**: done
## 结果
- 358 线性 commit → 14 史诗 × (`feature/*`|`fix/*` + `merge --no-ff`) + 1 root anchor = **373 commit**
- `git diff backup/pre-rewrite-2026-09-13 dev` 为空
- `go test -short ./...` PASS
- 旧历史:`dev-old-linear`、`backup/pre-rewrite-2026-09-13`
## 产物
- [`scripts/history-epic-manifest.tsv`](../../../scripts/history-epic-manifest.tsv)
- [`scripts/rewrite-history-epics.sh`](../../../scripts/rewrite-history-epics.sh)
- [`scripts/generate-commit-rewrite-map.py`](../../../scripts/generate-commit-rewrite-map.py)
- [`reference/commit-rewrite-map-2026-09-13.md`](../reference/commit-rewrite-map-2026-09-13.md)
## 远端
- `origin/dev|test|main` force-with-lease 同步至重组后 HEAD
@@ -1,62 +0,0 @@
---
title: "Herdr Agent 角色、备援与自动审批治理"
status: done
created: 2026-09-13
updated: 2026-09-13
owner: Codex
branch: feature/herdr-agent-governance
worktree: .worktrees/feature-herdr-agent-governance
mutex: ops-governance
---
# Herdr Agent 角色、备援与自动审批治理
## 目标
建立可审计的 Herdr Agent 能力分工、额度保护、故障接管和免人工工具审批入口,并明确 Herdr PI 与产品容器 PI Agent Runner 不是同一执行体。
## 范围
- 持久化主责、备份顺序、任务泳道和接管条件。
- 为已安装的 Claude、Codex、Cursor、Antigravity、PI、Kimi、Cline CLI 提供统一启动入口。
- 自动审批仍受仓库、worktree、mutex、集成槽和破坏性操作红线约束。
- 提供保守的自动派发:只向同工作目录、空闲的规范命名实例投递;明确失败时降级,超时停止重复投递。
## 非目标
- 不重启或接管当前正在执行 DOCREV/CHAT/INTENT 的实例。
- 不修改容器内 PI Agent Runner 的模型、凭证、配置或运行状态。
- 不操作共享 Docker 或推送远端。
- 不将删库、强推、密钥读取/外传等不可逆动作纳入无条件许可。
## 步骤
1. [x] 盘点 Herdr 0.9.0、在线实例、集成状态、CLI 版本和审批参数。
2. [x] 写入项目级角色与备援 SSOT,并在 AGENTS/PROJECT 建立入口。
3. [x] 实现统一自动审批启动脚本和保守派发脚本。
4. [x] 完成静态检查、脚本 dry-run 与路由验收。
5. [x] 更新任务状态、提交 feature 分支并合入 `dev`。
## 验收标准
- [x] 每种当前可调用 CLI 都有明确角色、主备关系和自动审批启动参数。
- [x] Codex/Claude 的高成本推理与 Cursor/Flash 模型的实施负载分离。
- [x] 明确禁止因 timeout/unknown 状态盲目重复派发。
- [x] Herdr PI 与产品容器 PI 在名称、职责和动作上不会混淆。
- [x] 启动和派发脚本通过 `bash -n`,dry-run 不启动实例、不执行任务。
## 相关链接
- Agent roster: [../../ops/2026-09-13-herdr-agent-roster.md](../../ops/2026-09-13-herdr-agent-roster.md)
- Handoff: [../../ops/handoffs/2026-09-13-herdr-agent-governance.md](../../ops/handoffs/2026-09-13-herdr-agent-governance.md)
- Test report: 本任务文“证据 / 备注”
## 证据 / 备注
- `herdr status`: client/server 0.9.0,protocol 22,兼容。
- `herdr integration status`: Claude/Codex/Cursor/Antigravity/PI/Kimi integration current;Cline CLI 3.0.61 可调用。
- CLI 版本:Claude 2.1.270、Codex 0.154.0、Cursor 2026.09.10、Antigravity 1.2.2、PI 0.85.1、Kimi 0.41.0、Cline 3.0.61。
- `bash -n scripts/herdr-agent-start.sh scripts/herdr-agent-dispatch.sh`: PASS。
- 七种启动 profile dry-run:PASS;未启动或重启实例。
- 七条 lane `--explain`:PASS。
- 非法标准名:exit 2;无在线标准实例:逐级跳过并 exit 69,未误投任务。
@@ -1,37 +0,0 @@
---
title: "受控文档正文修复真实 UI 实战验收"
status: done
owner: verifier_antigravity
branch: fix/controlled-content-ui-acceptance
mutex: document-content-ui-acceptance
created: 2026-09-14
updated: 2026-09-14
---
# 目标
仅通过真实浏览器页面操作,验证项目 143 历史文档恢复,并以真实产品 PI Agent Runner / 智能体小队完成新项目文档全链路。API、数据库和 stub 不能替代 UI 验收结果。
# 范围
- 项目 143:登录、打开正文、30 秒空闲、双击编辑保存、三种变更视图、刷新与重新登录持久化。(clean-run3 已全部 PASS)
- 新项目:从 UI 创建,真实对话触发工作流/小队生成文档,再次对话触发修改;页面查看助手回复、文档正文、版本账本、影响、风险、开放问题。(full-chain-final UI-00..UI-16 全部 18 项 PASS)
- 冲突与权限:双页面并发编辑、审核人/无关用户访问边界均通过;宿主容器重启后 post-restart 复验通过。
- Ubuntu Server 浏览器:统一使用 Playwright 官方 `mcr.microsoft.com/playwright:v1.63.0-noble` 容器。
# 红线
- 不用 API 直建用户、项目、会话、文档或测试数据。
- 不注入/伪造 assistant 消息、文档、账本、change report 或通过结果。
- 所有通过项必须有页面可见证据;失败如实记录为 FAIL。
- 测试账号凭证只读本机既有 secrets/phase 文件,不输出、不提交。
# 阶段判据与进展
- [x] 项目 143 页面正文可见且无 content/revision 404(UI-143-01..06 全 PASS,产物在 `clean-run3/`)。
- [x] 人工编辑、视图切换、刷新/重登持久化通过(项目 143 回归)。
- [x] 新项目真实 PI/小队链路及文档影响风险报告页面可见(UI-00..05b 通过,首轮 toolbar V2/r0,UI-05 pending 保持 V2,UI-05a 确认后晋升 V3,UI-05b 拒绝后保持 V3)。
- [x] UI-06 硬刷新正文保留通过(合入 08bf615 修复后 1.1 秒内秒级通过)。
- [x] 并发、权限、重启前凭据生成有真实 UI 判定(UI-12/13a/13b/15/16 全 PASS)。
- [x] 容器重启后恢复核验通过(UI-15 post-restart 2.8 秒秒级通过,V3/r2 与标记完好呈现,目标 404=0)。
- [x] 测试报告落盘至 `.doc/test-reports/2026-09-14-controlled-content-ui-acceptance.md`。
@@ -1,42 +0,0 @@
---
title: "运行时 UI 证据计数与 race 秒数纠错"
status: done
created: 2026-09-14
updated: 2026-09-14
owner: Cursor-Auto
branch: fix/document-revision-evidence-count
worktree: "-"
mutex: document-revision-evidence-count
---
# 运行时 UI 证据计数与 race 秒数纠错
## 目标
把顶层截图写成 21(20 main/pre + 1 post),并把全包 race 写成 `FAIL 109.279s`,不与 21 条 results 混淆。
## 范围
- 最终报告、UI checklist、CURRENT
- 本短任务登记后即关闭
## 非目标
- 不改业务代码、assets、容器,不 push
- 不改 UI PASS 判定,不提交 secrets
## 步骤
1. [x] 从 `dev@5d79da6` 开 `fix/document-revision-evidence-count` 并登记
2. [x] 截图 21 = 20 main/pre + 1 post;race `FAIL 109.279s`
3. [x] `git diff --check`;只提交文档
## 验收标准
- [x] 报告/清单不再把 20 张截图与 21 条 JSON 混写
- [x] 全包 race 不再写成 `ok ... 110.723s`
- [x] assets 未 stage
## 相关链接
- Test report: [../../test-reports/2026-09-14-document-revision-runtime-ui-test-report.md](../../test-reports/2026-09-14-document-revision-runtime-ui-test-report.md)
@@ -1,45 +0,0 @@
---
title: "文档账本运行时 UI 最终报告收口"
status: done
created: 2026-09-14
updated: 2026-09-14
owner: Cursor-Auto
branch: feature/document-revision-runtime-ui-final-report
worktree: "-"
mutex: document-revision-runtime-ui
---
# 文档账本运行时 UI 最终报告收口
## 目标
在 `dev@b258ab8` 上只写文档,把 Round20 真实 UI 验收收口为 test-report,并释放运行时集成槽。
## 范围
- `.doc/test-reports/2026-09-14-document-revision-runtime-ui-test-report.md`
- management report、UI checklist、runtime / PG-id 文档、FEATURE-MATRIX、gap-matrix、CURRENT
## 非目标
- 不改业务代码、不跑容器、不 push、不提交 assets
- 不引用 `phase-secrets.local.json` 内容
- 不把全仓标 `production_ready=yes`
## 步骤
1. [x] 从 `dev@b258ab8` 开 `feature/document-revision-runtime-ui-final-report`
2. [x] 按 results JSON 写 Input/Actual/Verdict/Duration
3. [x] 同步任务文档并释放集成槽
4. [x] 原子 docs commit
## 验收标准
- [x] 运行时范围 PASS/done
- [x] `production_ready` 仍为 no;`CHAT-INTENT` 保留
- [x] 历史失败资产未改删
## 相关链接
- Test report: [../../test-reports/2026-09-14-document-revision-runtime-ui-test-report.md](../../test-reports/2026-09-14-document-revision-runtime-ui-test-report.md)
- Checklist: [../checklists/2026-09-13-document-revision-runtime-ui-acceptance.md](checklists/2026-09-13-document-revision-runtime-ui-acceptance.md)
@@ -1,47 +0,0 @@
---
title: "文档账本运行时会话关闭归档"
status: done
created: 2026-09-14
updated: 2026-09-14
owner: Cursor-Auto
branch: feature/document-revision-session-close
worktree: "-"
mutex: document-revision-session-close
---
# 文档账本运行时会话关闭归档
## 目标
按 AGENTS 会话关闭清单:把已 done 的 document-revision short-term / checklist / handoff 迁入 archive,并修好相对链接。
## 范围
- `.doc/ops/short-term/*document-revision*`
- 4 个专项 checklist + runtime-ui-acceptance
- 4 个 document-revision handoff
- `.doc` 内因移动失效的相对链接
- 本任务完成后一并归档
## 非目标
- 不改业务代码、assets、容器,不 push
- 不改 `production_ready=no`、fallback / race 结论
- 不改非 document-revision 任务
## 步骤
1. [x] 从 `dev@4bf8b6d` 开 `feature/document-revision-session-close` 并登记
2. [x] short-term / checklist / handoff 标 done 后 `git mv` 入 archive
3. [x] 扫描并重写失效相对链接;`git diff --check`
## 验收标准
- [x] CURRENT 焦点仅非 DOCREV;槽位 idle
- [x] 本次移动文件的相对 Markdown 链接可解析
- [x] assets 未 stage
## 相关链接
- Test report: [../../test-reports/2026-09-14-document-revision-runtime-ui-test-report.md](../../test-reports/2026-09-14-document-revision-runtime-ui-test-report.md)
- CURRENT: [CURRENT](../../ops/CURRENT.md)
@@ -1,61 +0,0 @@
---
title: "可靠事件与 FAV 集成 M2–M3"
status: cancelled
created: 2026-09-14
updated: 2026-09-15
owner: TBD
branch: refactor/durable-event-fav-integration
worktree: "-"
mutex: event-delivery
---
# 可靠事件与 FAV 集成 M2–M3
> 2026-09-15:本任务把 durable event 与未审计 FAV 绑成同一关闭条件,且步骤状态已与 U8/U9 后续交付漂移。任务停止使用;持久事件由 [Track E](../../ops/short-term/2026-09-15-durable-event-track-e.md) 接续,FAV subscriber 继续走独立审计,不把本条已勾选步骤视为生产 dispatcher 验收。
## 目标
完成 U5–U9,使投影、通知、RunManifest 和最终成果在多 worker、崩溃、重放和 workspace 清理后仍可恢复且不越权。
## 范围
- opaque workspace capability、lease 和 fencing。
- durable outbox、逐消费者 delivery/inbox、重试和 dead letter。
- 审计并集成 `feature/final-artifact-vault` 的适用实现。
- taskrun finalize、RunManifest 持久化、FAV coverage 和迁移 corpus。
## 非目标
- 不盲目整分支 cherry-pick FAV。
- 不启用跨授权图的 vault 读取。
- 不自动销毁 dev/main 数据。
- 不执行 U10–U12。
## 步骤
1. [x] 读取 M1 test report,确认继续 M2 的 go/no-go 已通过。
2. [x] 重新分配 Goose 序号并审计 U6/FAV schema 组合。
3. [x] 实现 U5–U6,多 app/worker 和 crash matrix 先通过。
4. [x] 逐文件审计 FAV 分支,按 U7 边界迁移合格实现。
5. [ ] 实现 U8,收敛 taskrun terminal finalize 与 RunManifest。
6. [ ] 实现 U9 的 checkpoint backfill、corpus、quarantine 和 cleanup gates。
7. [ ] 完成真实 PI、浏览器、workspace 清理、scratch recovery 和 rebuild 演练。
## 验收标准
- [ ] 多订阅者有独立 delivery,失败者不阻塞其他订阅者。
- [ ] worker crash/retry/replay 不造成重复可见副作用。
- [ ] workspace 清空后,verified 最终文档/回复仍可定位并校验。
- [ ] 授权图缺失、跨项目、tombstone、坏 digest 和 stale fencing 全部拒绝。
- [ ] clean/oldest/previous/hazard/import/reload/rollback/artifact recovery 八轨有独立证据。
- [ ] 任何数据销毁仍需完整备份、corpus、FAV coverage 和用户批准。
## 相关链接
- Checklist: [../checklists/2026-09-14-module-decoupling-refactor-acceptance.md](../../ops/checklists/2026-09-14-module-decoupling-refactor-acceptance.md)
- Handoff: 实施时创建
- Test report: 实施后按 M2、M3 分开创建
- Plan: [../../remediation/2026-09-14-module-decoupling-refactor-plan.md](../../remediation/2026-09-14-module-decoupling-refactor-plan.md)
## 证据 / 备注
本任务依赖 M1,不得与 M1 同时修改 docgov/docrevision 的事务主链。
@@ -1,81 +0,0 @@
---
title: "治理鉴权升级:职责-动作严格对应 + 未激活拦截 + 关闭创建直通"
status: done
created: 2026-09-14
updated: 2026-09-14
owner: implementer_cursor
branch: fix/governance-action-level-authz
worktree: ".worktrees/fix-governance-action-level-authz"
mutex: workflow
---
# 治理鉴权升级:职责-动作严格对应 + 未激活拦截 + 关闭创建直通
## 目标
采纳 [MVP 治理规则评审](../../ops/research/2026-09-14-mvp-governance-rules-review.md) 修正版原则:**允许零治理创建与普通对话;禁止零治理激活与执行文档任务(审批流动作)**。文档动作按职责鉴权,创建者不隐式越权,`initial_workflow_key` 不再直通 active。
## 决策记录(已定,不再开放)
- **A(用户拍板 2026-09-14)**:`DutyModeNone` 文档 = 不走人工审批但**可生成**(创建者触发,维持已实施 D4);「不可发起任务」收窄为不可发起**审批流动作**(submit/review/approve)。
- **B(按评审建议采纳)**:pre-activation 保留 202 契约——`POST /tasks/runs` 仍 202 创建 run,但置 blocked 状态、不启动小队、不取文档租约,chat 流内返回自然语言治理提示。
- **C(按评审建议采纳)**:移除 `isCreator` 对 full 文档的隐式全通行;`view` 豁免阶段收窄(项目访问成员可查看);创建者保留:配置成员/职责 + none 文档生成触发。
- **D(按评审建议采纳)**:关闭 `initial_workflow_key` 直通 active(仅挂载目录);后端/前端 types 字段废弃标注;E2E legacy 用例语义更新;dev 库 81 个 planning+with_wf 异态项目**只审计分类,不改库**。
## 采纳版职责-动作矩阵
| 动作 | full 文档 | none 文档 | 未激活(gov==nil) |
|------|-----------|-----------|--------------------|
| view | 项目访问成员 | 项目访问成员 | 项目访问成员 |
| run(首次生成/重生成) | 编制负责人 | **创建者**(无审批链) | 202 + blocked 状态,chat 内提示,不启小队/不取租约 |
| edit/submit(编辑/提交审核) | 编制负责人 | 拒绝(无审批链) | 拒绝 |
| review(审核/退回) | 审核负责人 | 拒绝 | 拒绝 |
| approve(批准/拒绝批准) | 批准负责人 | 拒绝 | 拒绝 |
| 配置成员/文档职责 | 创建者 | 创建者 | 创建者(planning 期配置正是本阶段语义) |
退回后形成「待编制人修订」;审核人不得直接启动重编(由编制负责人发起修订)。
## 范围
- `internal/projectinstance/document_access.go`(动作-职责映射、creator 例外移除、gov==nil 未激活拦截)
- `internal/projectinstance/stage_access.go`(view 豁免语义;`docTaskDutyForUser` 拆分为按职责判定)
- `internal/projectinstance/message_scope.go` + taskrun/chat handler(blocked 状态 + 自然语言提示)
- `internal/projectworkflow/service.go`(关闭 `initial_workflow_key` 直通)+ `types.go` 前后端字段废弃
- 受影响单测重写(`access_governing_pg_test.go` creator 断言、`TestCreateTaskRun_PreActivationAcceptedNot409` 语义细化)与 E2E legacy 用例
## 非目标
- 不改三权互斥与 DutyMode 校验(Wave 2 已完成)
- 不做运行中动态补配职责 / 按文档单独激活(冻结语义维持,激活页提示「留空文档不参与、不可补配」)
- 不做成员 role 枚举演进(MVP 维持创建者=项目管理员;role 演进留 backlog)
- 不改 dev 库存量数据(仅审计)
## 步骤
1. [x] 评审落盘 + 决策 A–D 收敛 + 本任务登记(Wave 5 已合入本地 `dev@19f6df5`,G0 已开工)
2. [x] G1 后端:`CheckDocTaskAccess` 动作-职责映射 + creator 例外移除(保留 none 生成触发)+ gov==nil 未激活拦截(202 契约保留);重写受影响单测
3. [x] G2 关闭 `initial_workflow_key` 直通 + 前后端字段废弃 + E2E legacy 用例更新
4. [x] G3 前端:chat 治理拦截自然语言提示、按钮级职责禁用、激活确认页冻结提示补强
5. [x] G4 dev 库 planning+with_wf 异态审计分类(只读报告,现测 83 条均为测试夹具)
6. [x] G5 集成验证 + 测试报告归档(新项目全链路:零治理创建→对话→配置→激活→职责动作负例)
## 验收标准
- [x] full 文档 API 负例:author 不可 review/approve;reviewer 不可 run/edit/submit;approver 不可 run/edit/review;creator 不可任一审批动作(view 除外)
- [x] none 文档:创建者可触发生成;submit/review/approve 全拒
- [x] 未激活项目编制类输入:消息正常显示、run 202 且 blocked、无小队/租约、chat 内明确治理提示文案(页面用「请编制用户初始需求收集表」命中任务 API)
- [x] `POST /projects` 带 `initial_workflow_key`:不再置 active,工作流目录仍自动挂载
- [x] `go vet ./...`、`go test -short ./...`、`cd web && npm test && npm run build` 全绿
- [x] 异态审计报告与测试报告归档并回链
## 相关链接
- Research(评审与决策记录): [2026-09-14-mvp-governance-rules-review.md](../../ops/research/2026-09-14-mvp-governance-rules-review.md)
- 前序 Remediation(已实施 Wave 1–4): [2026-09-14-workflow-plan-409-frozen-and-optional-duties-remediation.md](../../remediation/2026-09-14-workflow-plan-409-frozen-and-optional-duties-remediation.md)
- 202 契约来源: [2026-09-13-workflow-access-chat-members-ui01-02.md](../../audit/2026-09-13-workflow-access-chat-members-ui01-02.md)
## 证据 / 备注
- Wave 5 已合入本地 `dev@19f6df5`;本任务 worktree 已从该 `dev` 创建,mutex `workflow` 进入 `in_progress`。
- G4 只读复测:141 active / 209 planning;**83** 个 planning 带非空 `active_workflow_key`,全部为 `PROJ_MGR_*`/`TEST_PROJ_*` 夹具。见 [audit](../../audit/2026-09-14-planning-with-workflow-key-anomaly.md)。
- G5 验收:[2026-09-14-governance-action-level-authz-test-report.md](../../test-reports/2026-09-14-governance-action-level-authz-test-report.md)。
@@ -1,55 +0,0 @@
---
title: "模块解耦架构与重构计划修订"
status: done
created: 2026-09-14
updated: 2026-09-14
owner: Codex
branch: feature/module-decoupling-remediation
worktree: .worktrees/feature/module-decoupling-remediation
mutex: architecture-docs
---
# 模块解耦架构与重构计划修订
## 目标
把模块解耦方案修订为可以分段实施、验证和回滚的架构与重构计划,补齐事务、并发互斥、授权、可靠事件、FAV、数据迁移和真实页面验收。
## 范围
- 修订模块化单体架构设计与 ADR。
- 新增详细整改与重构计划。
- 建立首个文档可靠性纵向试点及后续里程碑任务。
- 更新 CURRENT、FEATURE-MATRIX 和相关索引。
## 非目标
- 本任务不修改业务代码、数据库迁移或部署配置。
- 本任务不合并 `feature/final-artifact-vault`,只定义其集成依赖和边界。
- 本任务不执行共享容器验证,也不占用集成槽位。
## 步骤
1. [x] 对照当前源码、已接受 ADR、FAV 分支和外部权威资料复核原方案。
2. [x] 修订架构设计与 ADR。
3. [x] 编写详细整改计划、里程碑任务和验收清单。
4. [x] 更新协作 SSOT 与索引并完成文档一致性检查。
## 验收标准
- [x] 计划明确事务所有权、锁顺序、事件投递语义、授权主体和恢复边界。
- [x] 首个独立交付边界直接覆盖受控文档刷新、重启、投影缺失和授权负例。
- [x] 每个后续里程碑有依赖、文件范围、并发风险、测试矩阵、停走门和回滚边界。
- [x] FAV、迁移语料库和完整备份的职责不重叠,工作区不再承担最终成果事实源。
## 相关链接
- Checklist: [../../ops/checklists/2026-09-14-module-decoupling-refactor-acceptance.md](../../ops/checklists/2026-09-14-module-decoupling-refactor-acceptance.md)
- Handoff: 不需要;实现阶段使用两个 planned short-term 接续
- Test report: 本任务仅产出计划,不生成业务验收报告
## 证据 / 备注
- 原方案位于主工作区未跟踪文件;本任务在独立 worktree 重建并修订,未覆盖原工作区。
- `feature/final-artifact-vault` 已有实现与测试证据,但尚未合入本任务基线,实施前必须重新审计分支差异。
- 文档校验:本地相对链接、R/KTD/U ID 唯一性、Mermaid fence 和 `git diff --check` 均通过。
@@ -1,48 +0,0 @@
---
title: "项目 143 受控文档正文 404 现场诊断"
status: done
created: 2026-09-14
updated: 2026-09-14
owner: Codex
branch: fix/project143-controlled-content-404-diagnosis
worktree: "-"
mutex: docgov-content-diagnosis
---
# 项目 143 受控文档正文 404 现场诊断
## 目标
定位已登录用户打开项目 143 时 `doc_proj143_intake` 正文接口返回 404 的当前根因,并形成可复核的整改边界。
## 范围
- 对照当前 dev 源码、数据库、工作区文件与既有真实 UI 证据。
- 分析服务端 404 条件、前端 hydration 与重复请求条件。
- 形成审计记录和整改建议;本轮不修改业务代码。
## 非目标
- 不恢复或覆盖用户文档数据。
- 不以 API 探针或伪造数据替代后续真实浏览器验收。
- 不继续纯软件项目自举方案实施。
## 步骤
1. [x] 核对项目 143 的项目、文档记录、账本与工作区事实源。
2. [x] 核对正文 handler 的 404 分支和前端 hydration 重试条件。
3. [x] 记录根因、影响范围、整改顺序和验收要求。
## 验收标准
- [x] 404 的直接原因与数据/代码证据相互印证。
- [x] 明确区分历史项目数据缺口、当前能力回归和前端错误放大。
- [x] 不宣称未执行的浏览器或真实 PI 结果。
## 相关链接
- Audit: [../../audit/2026-09-14-project143-controlled-content-404.md](../../audit/2026-09-14-project143-controlled-content-404.md)
## 证据 / 备注
结论:文件存在;raw/canonical 哈希因 5 处 Markdown 双空格硬换行产生 10-byte 差异。该空格具有渲染语义,须保全原文修复。详见 Audit 与 Remediation。
@@ -1,51 +0,0 @@
---
title: "纯软件项目自举工作流方案"
status: done
created: 2026-09-14
updated: 2026-09-14
owner: Codex
branch: feature/software-project-bootstrap-plan
worktree: "-"
mutex: workflow-design
---
# 纯软件项目自举工作流方案
## 目标
基于当前 Agent-System 的真实能力,设计一套可创建、可配置、可冻结、可执行、可验收的纯软件项目自举工作流,并明确复用智能体小队、文档模板、权限与阶段门禁的实施路线。
## 范围
- 当前项目创建、工作流、阶段、文档、智能体小队和 UI 能力盘点
- 纯软件项目的创建选项、阶段模型、交付物、门禁、角色与小队设计
- 从最小可用版本到完整自举闭环的实施拆分、数据迁移、API/UI 与验收计划
## 非目标
- 本轮不修改 Go、React、数据库迁移、模板或智能体配置
- 不把医疗器械合规要求默认带入纯软件项目
- 不宣称尚未实现的方案已经可用
## 步骤
1. [x] 盘点当前实现与可复用能力
2. [x] 完成详细系统设计和创建向导设计
3. [x] 给出分阶段实施与真实验收计划
4. [x] 更新 FEATURE-MATRIX、CURRENT 并完成文档校验
## 验收标准
- [x] 方案覆盖工作流、文档、智能体小队、角色权限、项目创建选项、状态机、API/UI、迁移和验收
- [x] 清楚区分已实现、可复用、需新增和暂缓项
- [x] 自举机制有边界、有人工确认点且不会让智能体自行修改治理规则
## 相关链接
- Research: [../../ops/research/2026-09-14-software-project-bootstrap-current-state.md](../../ops/research/2026-09-14-software-project-bootstrap-current-state.md)
- Design: [../../system-design/2026-09-14-software-project-bootstrap-workflow.md](../../system-design/2026-09-14-software-project-bootstrap-workflow.md)
- Checklist: [../../ops/checklists/2026-09-14-software-project-bootstrap-acceptance.md](../../ops/checklists/2026-09-14-software-project-bootstrap-acceptance.md)
## 证据 / 备注
本轮为设计任务;所有当前态结论已回链源码、迁移或现有测试报告。主方案 599 行,验收计划 207 行;`git diff --check` 通过,相关文档 84 条相对链接校验无坏链。未运行产品功能测试,验收清单全部保持 `NOT RUN`。
@@ -1,40 +0,0 @@
---
title: "Vite 允许 FRP Host(frp-mix.com)"
status: done
created: 2026-09-14
updated: 2026-09-14
owner: Cursor-Auto
branch: fix/vite-frp-allowed-hosts
worktree: "-"
mutex: web-devserver
---
# Vite 允许 FRP Host(frp-mix.com)
## 目标
通过 FRP 映射访问 `:3100` 时,Vite 不再拦截 `Host: frp-mix.com`。
## 范围
- `web/vite.config.ts`:`server.allowedHosts` 增加 `.frp-mix.com`
## 非目标
- 不改生产 nginx / 反向代理配置
- 不放开全部任意 Host(保持显式白名单)
## 步骤
1. [x] 在 `fix/vite-frp-allowed-hosts` 上改 `allowedHosts`
2. [x] 重启本地 Vite `:3100`
## 验收标准
- [x] 通过 `frp-mix.com`(FRP→3100)可打开开发页,不再出现 `Blocked request. This host is not allowed`
## 相关链接
- Checklist: —
- Handoff: —
- Test report: —
@@ -1,71 +0,0 @@
---
title: "workflow-plan 409 冻结态守卫 + 文档职责可选治理"
status: done
created: 2026-09-14
updated: 2026-09-14
owner: implementer_cursor
branch: fix/workflow-plan-409-frozen-and-optional-duties
worktree: ".worktrees/fix-workflow-plan-409-frozen-and-optional-duties"
mutex: workflow
---
# workflow-plan 409 冻结态守卫 + 文档职责可选治理
## 目标
已激活项目的设置页进入明确的冻结只读态;非必需且允许裁剪的文档可选择“不纳入人工审批”,部分职责、必需文档空职责、非成员职责和零治理激活由服务端拒绝;门禁、权限、快照与页面语义保持一致。
## 范围
- `web/src/components/project/ProjectSettingsModal.tsx`:frozen 视图、逐文档审批开关、内联/sticky 错误、并发恢复。
- `web/src/api/projectSettings.ts`:保留 status/code/message/issues 的 typed error。
- `internal/projectinstance/validator.go`:统一 DutyMode、工作流定义约束、结构与成员校验。
- `internal/projectinstance/service.go`:保存/预览/激活重复复核 active members。
- `internal/projectinstance/gate.go`、`stage_access.go`、`document_access.go`:none/full/disabled 一致语义。
- `internal/projectinstance/store.go`、`internal/workflow/runtime/orchestrator.go`:快照清理、零 assignment rows、零职责运行时契约。
- 激活预览统计与相应前后端测试。
## 非目标
- 不修改项目 143 的现有工作流配置,不在验收中终止项目 143。
- 不支持部分指派或自动补齐职责。
- 不允许项目配置降低工作流定义中必需/阻断文档的治理要求。
- 不把“无需人工审批”文档改成无版本、无审计的非受控文档。
- 不迁移历史 active 实例;冻结快照继续作为历史 SSOT。
## 步骤
1. [x] 定位项目 143 的 409 `PLAN_FROZEN` 根因并落盘 audit。
2. [x] 完成方案审核:补齐定义优先、零治理拦截、成员有效性、权限、快照清理和真实 UI 边界。
2b. [x] 用户批准最终方案,开工登记(Wave 0)
3. [x] Wave 1:typed API error + frozen 独立只读视图 + sticky/可访问错误 + 两标签竞态恢复。
4. [x] Wave 2:DutyMode、强制/可选任务策略、partial/成员/零治理校验、服务端规范化。
5. [x] Wave 3:门禁、readiness、阶段/文档访问、运行时和预览统计统一。
6. [x] Wave 4:前端逐文档“纳入人工审批”开关及 full/none/partial 交互测试。
7. [x] Wave 5:合 dev、rebuild、真实浏览器设置页矩阵;项目 143 只读回归;归档 test report。真实 PI 生成/审批长链路未跑,见报告。
## 验收标准
- [x] active 项目设置无编辑控件,页面显示冻结原因、工作流/阶段/职责快照和受控终止影响入口。
- [x] 允许裁剪的非必需文档 full/none 均合法;partial 精确拒绝。
- [x] 必需/阻断/不可裁剪文档全空被服务端拒绝(单测 + 定义优先)。
- [x] 保存和激活均拒绝非 active project member;预览后成员退出也 fail closed(单测)。
- [x] 所有文档 none 时可走预览拒绝「至少一份纳入人工审批」(页面 C)。
- [ ] none 文档仍生成和入账本、项目成员只读可见、创建者可生成/编辑,但无 review/approve 且不阻塞阶段(**本轮未跑真实 PI,单测已覆盖门禁/权限**)。
- [x] disabled/none 的冻结快照、plan hash 和 assignment rows 不残留旧职责(Wave 3 单测)。
- [x] 两标签陈旧保存的 409 在当前视口可见、草稿保留并转 frozen。
- [x] 设置页真实 UI 用例有截图证据并回链;生成/审批长链路另立项。
## 相关链接
- Audit: [2026-09-14-workflow-plan-409-frozen-and-optional-duties.md](../../audit/2026-09-14-workflow-plan-409-frozen-and-optional-duties.md)
- Remediation: [2026-09-14-workflow-plan-409-frozen-and-optional-duties-remediation.md](../../remediation/2026-09-14-workflow-plan-409-frozen-and-optional-duties-remediation.md)
- Test report: [2026-09-14-workflow-plan-409-frozen-and-optional-duties-test-report.md](../../test-reports/2026-09-14-workflow-plan-409-frozen-and-optional-duties-test-report.md)
## 证据 / 备注
- dev 项目 143:`lifecycle_status=active`、`active_workflow_key=main`、实例 89 active;409 与三名职责人选择内容无关。
- 当前 `parseError` 已读取后端 message;前端改造重点是 typed error、冻结态切换和视口内呈现。
- 当前职责校验只检查正数/互异,数据库只外键到 users;项目成员有效性必须补服务端校验。
- 当前终止实现会取消运行任务、关闭实例并退回 planning;关闭实例访问 fail closed,因此项目 143 不能作为终止测试对象。
- 方案已迁移至基于最新 dev 的 `fix/workflow-plan-409-frozen-and-optional-duties` 独立 worktree;用户已批准实施。
@@ -1,63 +0,0 @@
---
title: "M5/M6 组合根与传输门禁 U11–U12"
status: done
created: 2026-09-15
updated: 2026-09-15
owner: Cursor
branch: feature/app-composition-u11-u12
worktree: "-"
mutex: app
---
# M5/M6 组合根与传输门禁 U11–U12
## 目标
按整改计划四个子切片完成组合根、文档通知闭包迁出、stageflow 用例、UserProjectContext CAS;再收口 SSE 编码与已清零规则的 arch-check block。用户已明确授权继续 U11/U12(推翻 U10 报告的停止扩面)。
## 范围
- U11a:`internal/app` 唯一 composition root;幂等 Start/Stop
- U11b:文档 `OnOutbox` 通知迁到 `internal/app/docnotify`
- U11c:`internal/app/stageflow` 拥有 ExecuteTask / ExecuteStage
- U11d:`ContextUpdate` 版本 CAS,禁止跨模块字段级直改
- U12:SSE 中性 frame 编码;`import`/`event` 转 block;不改错误信封与 PI Runner 协议
## 非目标
- 不碰 `intent` 包行为(编码阶段 mutex 仍由 Codex 占用;合入后浏览器门另开 handoff)
- 不整支 merge `feature/final-artifact-vault`;不启用 `FAV_DEGRADED_READ`
- 不终止或改写项目 143
- 不删除未到期的 sql_write/path 例外(U3/U5 残留)
- 不在 worktree 内 `env-service`
## 步骤
1. [x] 认领 CURRENT + 本任务
2. [x] U11a composition root
3. [x] U11b docnotify
4. [x] U11c stageflow
5. [x] U11d ContextUpdate
6. [x] U12 SSE + arch-check block_kinds
7. [x] 短测 / 目标包 race / 报告
8. [x] 占槽 `--no-ff` 合入 `dev` + 主仓 `dev rebuild`
## 验收标准
- [x] 重复 Start 不重复注册 subscriber;Stop 后再 Start worker 仍在
- [x] server 生产代码不再赋值 `OnOutbox`
- [x] HTTP 与 CLI 走同一 stageflow 用例
- [x] ContextUpdate 并发 stale version 不丢更新赢家
- [x] `arch-check --mode block` 对已清零的 import/event 通过
- [x] 测试报告回链 U11/U12
- [x] 合入后 `/health` `/ready` schema 38、`pi-agent`、新镜像 digest
## 相关链接
- Checklist: [../../ops/checklists/2026-09-14-module-decoupling-refactor-acceptance.md](../../ops/checklists/2026-09-14-module-decoupling-refactor-acceptance.md)
- Plan: [../../remediation/2026-09-14-module-decoupling-refactor-plan.md](../../remediation/2026-09-14-module-decoupling-refactor-plan.md)
- Test report: [../../test-reports/2026-09-15-app-composition-u11-u12-test-report.md](../../test-reports/2026-09-15-app-composition-u11-u12-test-report.md)
## 证据 / 备注
用户口头授权:「继续解耦到 U11、U12」。合入 `dev@bf59cce`。rebuild 镜像 `sha256:a8e3e940f01111c4298c67947ae9f4cd6105f13cf58134672f4a87daa19e27ab`。health/ready:`.doc/test-reports/assets/2026-09-15-app-composition-u11-u12/rebuild-health-ready.txt`。
@@ -1,45 +0,0 @@
---
title: "D4 bizdev locator 最终移除"
status: done
created: 2026-09-15
updated: 2026-09-15
owner: Cursor
branch: fix/bizdev-locator-removal
worktree: "-"
mutex: bizdev
---
# D4 bizdev locator 最终移除
## 目标
删除 bizdev 上 8 个 locator getter;组合根一次性 Snapshot 后由 Runtime/Server 持有端口。
## 范围
- `Pool` `DocGov` `DocRevision` `ContextManager` `CAS` `ProjectWorkflow` `FreeformDoc` `KB`
- Runtime / Server 字段
- archtest 禁止把 getter 加回去
- 调用方迁移
## 非目标
- 不删 SchemaVersion / DatabaseReady
- 不切事件 live
- 不实现 Track P
## 步骤
1. [x] Snapshot + Runtime 端口
2. [x] 迁移 server/cmd/tests
3. [x] 同批删除 8 getter
4. [x] 报告合入
## 验收标准
- [x] 生产无 8 个 getter
- [x] [S1 报告](../../test-reports/2026-09-15-bizdev-locator-removal-test-report.md)
## 相关链接
- Phase 2 D4
@@ -1,39 +0,0 @@
---
title: "D7b chat 编排剩余批次"
status: done
created: 2026-09-15
updated: 2026-09-15
owner: Cursor
branch: fix/chatflow-orchestration-boundary
worktree: "-"
mutex: chat
---
# D7b chat 编排剩余批次
## 目标
`internal/chat` 生产代码不再 import bizdev;任务请求走 stageflow 类型别名。
## 范围
- action_executor 去掉 Bizdev 字段
- 收紧 chat import allowlist
- 表征测试保留
## 非目标
- 不搬空测试 import
- 不把 taskrun 签名从 bizdev 别名拷成独立结构
- 不切事件 live
## 步骤
1. [x] action_executor 改 stageflow 类型
2. [x] 收紧 yaml
3. [x] 报告合入
## 验收标准
- [x] chat 生产无 bizdev import
- [x] [S4b 报告](../../test-reports/2026-09-15-chatflow-orchestration-boundary-test-report.md)
@@ -1,59 +0,0 @@
---
title: "U10 chatlog/contextasm 原地端口化"
status: done
created: 2026-09-15
updated: 2026-09-15
owner: Cursor
branch: feature/chatlog-contextasm-u10
worktree: "-"
mutex: chat
---
# U10 chatlog/contextasm 原地端口化
## 目标
在不物理拆包的前提下,为对话读取与 prompt 装配建立带 Principal 的消费者端口,使正文、分类、计数、导出、摘要和恢复使用同一授权可见集合。
## 范围
- `internal/app/chatflow` ChatLog / ContextAssembler 端口
- ctxmgr 表所有权不变;adapter 内做可见性过滤
- server 历史读取 handler 改走 ChatLog;忽略 query/body 中的 user_id 身份
- 会话 restore / 记忆召回只注入允许集合
- 不碰 `intent` mutex,不物理搬到 `chatlog`/`contextasm` 包
## 非目标
- U11–U12
- 整支 merge `feature/final-artifact-vault`
- 启用 `FAV_DEGRADED_READ`
- 纯搬包
## 步骤
1. [x] 核实 `chat` mutex:`fix/chat-history-refresh` 已是 `dev` 祖先;剩余真实 PI 刷新与 U10 同批收口
2. [x] 从最新 `dev` 开 `feature/chatlog-contextasm-u10` 并登记 CURRENT
3. [x] 定义 chatflow 端口与 ctxmgr adapter
4. [x] 迁移 window/day/stats/search/unread/export/digest/history/restore/memory
5. [x] 合同测试:同集计数、非 owner 403、restore/digest 不放大不可见消息
6. [x] 验收报告;最后一句 **停止扩面**
## 验收标准
- [x] 刷新前后同一授权集合的正文与分类计数一致(adapter 合同测试)
- [x] 跨用户负例 fail closed(guest 非 owner)
- [x] context assembly / digest 只使用允许集合
- [x] 真实 PI 闲聊刷新 E2E 证据(与对话刷新活验同批;编制任务链 save 400 未纳入停走)
- [x] 未物理拆包;DTO 转换为 0,拆包收益不成立
## 相关链接
- Checklist: [../checklists/2026-09-14-module-decoupling-refactor-acceptance.md](../checklists/2026-09-14-module-decoupling-refactor-acceptance.md)
- Plan: [../../remediation/2026-09-14-module-decoupling-refactor-plan.md](../../remediation/2026-09-14-module-decoupling-refactor-plan.md)
- Chat refresh: [../../test-reports/2026-09-13-chat-history-refresh-test-report.md](../../test-reports/2026-09-13-chat-history-refresh-test-report.md)
- Test report: [../../test-reports/2026-09-15-chatlog-contextasm-u10-test-report.md](../../test-reports/2026-09-15-chatlog-contextasm-u10-test-report.md)
## 证据 / 备注
U9 最后一句 **继续 U10** 只批准进入 M4。禁止 U11–U12。`intent` 认领仍 `in_progress`,本单元不改意图分类。活验项目 6252 / `sess-p6252-u10`;产物 `.doc/test-reports/assets/2026-09-15-chat-history-refresh-live/live.json`。未占槽 rebuild。
@@ -1,59 +0,0 @@
---
title: "M3 U9 存量回填、migration corpus 与数据生命周期"
status: done
created: 2026-09-15
updated: 2026-09-15
owner: Cursor
branch: feature/dataset-lifecycle-u9
worktree: "-"
mutex: dataset
---
# M3 U9 存量回填、migration corpus 与数据生命周期
## 目标
只保留可解释的演示/回归数据,并持续验证旧数据迁移、重载和受控恢复。backfill 可暂停续跑,异常进 quarantine;八条轨道可重复;销毁默认 fail closed。
## 范围
- dataset registry(pinned / demo / regression / migration_baseline / ephemeral / quarantine)
- checkpoint 分批 backfill:只枚举 snapshot、approved/commit event、completed chat turn
- SKIP LOCKED 多 worker;禁止扫描 workspace
- 销毁门禁:FAV coverage + 完整备份 restore + corpus + 精确 manifest + 双人批准 + quarantine 观察窗
- restore 拒绝共享 env DSN;只允许 scratch
- 八轨:clean / oldest-supported / previous / hazard / import / reload / rollback / artifact recovery
## 非目标
- U10–U12;不碰 `chat` / `intent` mutex
- 不整支 merge `feature/final-artifact-vault`;不启用 `FAV_DEGRADED_READ`
- 不修改历史 Goose;不销毁 `agent_system_dev/test/main`
- 不终止或改写项目 143;worktree 内禁止 `env-service`
## 步骤
1. [x] CURRENT 认领 `mutex=dataset`;从 `dev` 开 `feature/dataset-lifecycle-u9`
2. [x] Goose 00038 + `module-boundaries.yaml`
3. [x] `internal/artifactvault/backfill.go` + `internal/dataset` + `cmd/dataset`
4. [x] 硬化 `scripts/restore-system-db-drill.sh`
5. [x] 隔离库 + 八轨 + 目标包 `-race` + 占槽 rebuild
6. [x] 验收报告;最后一句 **继续 U10**
## 验收标准
- [x] backfill 中断、重复、并发新终态时分母/分子可复算且不重复 artifact
- [x] legacy-v0 / 旧 schema / 高 ID / projection fork / 缺 snapshot → quarantine 或升级
- [x] restore 拒绝共享 DSN、错误 storage identity、篡改 manifest、缺权限
- [x] coverage / backup / corpus 任一失败阻止 destroy
- [x] 批准 dataset 导入后关系、SHA、sequence 可复算
## 相关链接
- Checklist: `.doc/ops/checklists/2026-09-14-module-decoupling-refactor-acceptance.md`
- Plan: `.doc/remediation/2026-09-14-module-decoupling-refactor-plan.md` U9
- Test report: `.doc/test-reports/2026-09-15-dataset-lifecycle-u9-test-report.md`
## 证据 / 备注
见验收报告。Goose 00038。dev schema 38。
@@ -1,46 +0,0 @@
---
title: "D6 doccontent canonical 边界"
status: done
created: 2026-09-15
updated: 2026-09-15
owner: Cursor
branch: fix/doccontent-canonical-boundary
worktree: "-"
mutex: docgov
---
# D6 doccontent canonical 边界
## 目标
Markdown canonicalization 与 SHA 抽到 `internal/doccontent`;生产 `docgov` 不再 import `docrevision`。
## 范围
- `internal/doccontent`
- `docgov/lease.go` 改走 doccontent
- `docrevision` 薄封装保持旧调用方
- golden + wrapper 对账
## 非目标
- 不改 hash 语义
- 不碰项目 143 数据
- 不删 `docrevision.CanonicalizeMarkdown` 导出(兼容)
## 步骤
1. [x] 分支与 CURRENT
2. [x] 提取模块与切断 docgov→docrevision
3. [x] golden / arch-check
4. [x] 报告并合入
## 验收标准
- [x] 生产 docgov 不 import docrevision
- [x] project143 hard-break golden 仍过
- [x] [S3 报告](../../test-reports/2026-09-15-doccontent-canonical-boundary-test-report.md)
## 相关链接
- Phase 2: [../../remediation/2026-09-15-module-decoupling-ipc-phase2-remediation-plan.md](../../remediation/2026-09-15-module-decoupling-ipc-phase2-remediation-plan.md)
@@ -1,53 +0,0 @@
---
title: "Track E 持久事件交付"
status: done
created: 2026-09-15
updated: 2026-09-15
owner: Cursor
branch: fix/event-e2-hook-guard
worktree: "-"
mutex: events
---
# Track E 持久事件交付
## 目标
按 E0A→E0B→E1A→E1B→E1C 完成 notify、workflow advance、projection 的 PG 持久交付,并用授权页面刷新/重启恢复证据关闭 `DOC-RELIABILITY-PILOT` 的事件部分。
## 范围
- E0A:生产入口/UoW、event contract、runtime registry、历史数据与 sequence 门。
- E0B:PG dispatcher、attempt audit、独立进程、并发与故障注入。
- E1A/B/C:三个消费者独立 shadow、switch、rollback 和真实恢复验收。
## 非目标
- FAV consumer 激活、bizdev/chat/intent 结构重构、HTTP 错误信封、PI typed result。
- 删除或覆盖历史事件;在 E0A 通过前启动 dispatcher。
## 步骤
1. [x] E0A 单独建 short-term/分支,dispatcher 保持 off。
2. [x] E0A 报告通过后再认领 E0B。
3. [x] 依次交付 E1A notify、E1B workflow advance、E1C projection;每步独立 go/no-go。
4. [x] E2 兼容守卫:live 时闭包停写;hook API 待 live 窗口后删除。
5. [x] 同步 test report、CURRENT、FEATURE-MATRIX、gap-matrix、[复盘](../research/2026-09-15-track-e-retrospective.md)。
## 验收标准
- [ ] 满足 [Phase 2 Track E Definition of Done](../../remediation/2026-09-15-module-decoupling-ipc-phase2-remediation-plan.md#track-e-definition-of-done)(共享 live 与删除 hook API 仍开放)。
- [x] 每个波次拥有独立 owner、mutex、分支、报告和回滚证据。
- [x] 未把计划、MemoryBus、stub 或日志冒充生产 PG/browser/restart 验收。
## 相关链接
- Checklist: 按每个波次建立
- Audit: [Phase 2 方案审阅](../../audit/2026-09-15-module-decoupling-phase2-plan-review.md)
- Remediation: [Phase 2 修订计划](../../remediation/2026-09-15-module-decoupling-ipc-phase2-remediation-plan.md)
- Test report: [E2](../../test-reports/2026-09-15-event-e2-hook-guard-test-report.md)
- 复盘: [./research/2026-09-15-track-e-retrospective.md](../research/2026-09-15-track-e-retrospective.md)
## 证据 / 备注
本条只建立执行入口,不代表已批准 E0A 或已认领 mutex。实施前必须按 CURRENT 检查冲突并从当时最新 dev 建分支。
@@ -1,49 +0,0 @@
---
title: "E0A 事件生产、契约与历史数据门"
status: done
created: 2026-09-15
updated: 2026-09-15
owner: Cursor
branch: fix/event-production-scope-contract
worktree: "-"
mutex: events
---
# E0A 事件生产、契约与历史数据门
## 目标
组合根注入唯一 `docflow.Commands`;candidate-ready、downstream-impact、approved 三条链在同一 UoW 写 envelope/delivery;缺 env/project fail closed;FAV 不写入;allowlist 与 runtime registry parity;历史 inventory 分类且不删数据;dispatcher 保持 off。
## 范围
- D3 生产入口与作用域
- D10 既有 event allowlist 补全与 registry parity
- D11 inventory、sequence ADR、repair/quarantine/expire、replay 骨架、service principal 表
## 非目标
- 不实现/启动 PG dispatcher
- 不激活 FAV,不写 staging/artifact/publication
- 不删除历史事件
- 不开始 Track S/P
## 步骤
1. [x] 从最新 `dev` 开 `fix/event-production-scope-contract` 并登记 CURRENT
2. [x] 唯一 Commands、三条链同 UoW、FAV 隔离
3. [x] allowlist + registry parity + 动态 FAV 注册失败
4. [x] inventory/repair/replay/principal additive schema 与用例
5. [x] 连续性模型 ADR;gap blocking 关闭
6. [x] 隔离库 PG 证据与 test-report
## 验收标准
- [x] 见 [E0A 测试报告](../../test-reports/2026-09-15-event-e0a-production-scope-contract-test-report.md)
## 相关链接
- Remediation: [../../remediation/2026-09-15-module-decoupling-ipc-phase2-remediation-plan.md](../../remediation/2026-09-15-module-decoupling-ipc-phase2-remediation-plan.md)
- Track E: [./2026-09-15-durable-event-track-e.md](./2026-09-15-durable-event-track-e.md)
- Report: [../../test-reports/2026-09-15-event-e0a-production-scope-contract-test-report.md](../../test-reports/2026-09-15-event-e0a-production-scope-contract-test-report.md)
- ADR: [../../adr/2026-09-15-event-consumer-checkpoint.md](../../adr/2026-09-15-event-consumer-checkpoint.md)
@@ -1,43 +0,0 @@
---
title: "E0B PG dispatcher 基座"
status: done
created: 2026-09-15
updated: 2026-09-15
owner: Cursor
branch: feature/events-dispatcher-pg
worktree: "-"
mutex: events
---
# E0B PG dispatcher 基座
## 目标
原子 lease/attempt/heartbeat/fencing、独立 `cmd/events`、默认 mode=off、1/2/4 worker 与崩溃注入。
## 范围
- Goose 00040、ClaimLeases、cmd/events、compose events 服务
## 非目标
- 不把任何 consumer 切 live
- 不激活 FAV
- 不删除历史
## 步骤
1. [x] 从 E0A 后 `dev` 开 `feature/events-dispatcher-pg`
2. [x] additive schema + atomic claim
3. [x] worker/heartbeat/fencing/shadow scan
4. [x] cmd/events + compose
5. [x] 隔离库 PG + race + 报告
## 验收标准
- [x] [E0B 测试报告](../../test-reports/2026-09-15-event-e0b-dispatcher-pg-test-report.md)
## 相关链接
- Track E: [./2026-09-15-durable-event-track-e.md](./2026-09-15-durable-event-track-e.md)
- Report: [../../test-reports/2026-09-15-event-e0b-dispatcher-pg-test-report.md](../../test-reports/2026-09-15-event-e0b-dispatcher-pg-test-report.md)
@@ -1,48 +0,0 @@
---
title: "E1A notify shadow 与切换"
status: done
created: 2026-09-15
updated: 2026-09-15
owner: Cursor
branch: fix/event-notify-cutover
worktree: "-"
mutex: events
---
# E1A notify shadow 与切换
## 目标
notify 消费者具备 shadow 覆盖门、live 唯一可见结果与显式 rollback;生产集群保持 off。
## 范围
- Goose 00041、`EmitVisibleDocumentEvent`、`docnotify.EventConsumer`、Handler 与 Ack 同事务
- cmd/events 注册 notify(mode=off 时不 claim)
## 非目标
- 不把共享环境 notify 切 live
- 不删除 OnOutbox 闭包
- 不激活 FAV / workflow advance / projection live
## 步骤
1. [x] 从 E0B 后 `dev` 开 `fix/event-notify-cutover`
2. [x] additive `source_event_id` 与可见结果唯一索引
3. [x] shadow dry-run + live 同事务 ack
4. [x] fixture N=30、quarantine、correlation、rollback
5. [x] 隔离库 PG + race + 报告
## 验收标准
- [x] [E1A 测试报告](../../test-reports/2026-09-15-event-e1a-notify-cutover-test-report.md)
## 相关链接
- Track E: [./2026-09-15-durable-event-track-e.md](./2026-09-15-durable-event-track-e.md)
- Report: [../../test-reports/2026-09-15-event-e1a-notify-cutover-test-report.md](../../test-reports/2026-09-15-event-e1a-notify-cutover-test-report.md)
## 证据 / 备注
隔离库 `agent_rel_e1a` 测完已 DROP。共享 `event_consumer_modes.notify=off`。
@@ -1,44 +0,0 @@
---
title: "E1B workflow advance shadow 与切换"
status: done
created: 2026-09-15
updated: 2026-09-15
owner: Cursor
branch: fix/event-workflow-advance
worktree: "-"
mutex: events
---
# E1B workflow advance shadow 与切换
## 目标
workflow_advance 具备 shadow/live/rollback;并发或重放批准只产生一次阶段可推进可见结果。生产集群保持 off。
## 范围
- Goose 00042、`docadvance.EventConsumer`、`EmitVisibleStageReady`、MarkDocTaskApproved 走 fenced tx
- cmd/events 注册 workflow_advance
## 非目标
- 不把共享环境 workflow_advance 切 live
- 不删除 AddOnApprovedHook
- 不激活 FAV / projection live
## 步骤
1. [x] 从 E1A 后 `dev` 开 `fix/event-workflow-advance`
2. [x] additive source_event_id on stage_advance_requests
3. [x] consumer 重读文档并同事务 ack
4. [x] 隔离库并发/重放/quarantine/rollback
5. [x] 报告
## 验收标准
- [x] [E1B 测试报告](../../test-reports/2026-09-15-event-e1b-workflow-advance-test-report.md)
## 相关链接
- Track E: [./2026-09-15-durable-event-track-e.md](./2026-09-15-durable-event-track-e.md)
- Report: [../../test-reports/2026-09-15-event-e1b-workflow-advance-test-report.md](../../test-reports/2026-09-15-event-e1b-workflow-advance-test-report.md)
@@ -1,41 +0,0 @@
---
title: "E1C projection no-replace"
status: done
created: 2026-09-15
updated: 2026-09-15
owner: Cursor
branch: fix/event-projection-cutover
worktree: "-"
mutex: events
---
# E1C projection no-replace
## 目标
projection 消费者幂等只前进;共享集群保持 off。
## 范围
- Goose 00043、ProjectHeadNoReplace、docproject.EventConsumer
## 非目标
- 不把共享 projection 切 live
- 不激活 FAV
- 不删除闭包
## 步骤
1. [x] 分支与 additive schema
2. [x] no-replace SQL + consumer
3. [x] 隔离库 + race + worker 重启
4. [x] 报告
## 验收标准
- [x] [E1C 测试报告](../../test-reports/2026-09-15-event-e1c-projection-test-report.md)
## 相关链接
- Track E: [./2026-09-15-durable-event-track-e.md](./2026-09-15-durable-event-track-e.md)
@@ -1,48 +0,0 @@
---
title: "E2 闭包 live 停写与 Track E 复盘"
status: done
created: 2026-09-15
updated: 2026-09-15
owner: Cursor
branch: fix/event-e2-hook-guard
worktree: "-"
mutex: events
---
# E2 闭包 live 停写与 Track E 复盘
## 目标
在 dispatcher 仍默认 off 时保留 `OnOutbox` / `AddOnApprovedHook` 接线,使对应消费者切 `live` 后闭包立即停写,避免双写;并写 Track E 复盘。不关闭 `DOC-RELIABILITY-PILOT`。
## 范围
- `events.WriterLive`
- `docnotify.Subscriber.SkipWrite`
- Runtime / 遗留 HTTP hook 在 `workflow_advance` live 时 no-op
- 复盘与 E2 测试报告
## 非目标
- 不删除 hook API(须等 live 发布窗口)
- 不把共享 notify/advance/projection 切 live
- 不激活 FAV
- 不关闭 Track E 发布 blocker
## 步骤
1. [x] 从最新 `dev` 开 `fix/event-e2-hook-guard` 并登记 CURRENT
2. [x] WriterLive + 闭包守卫 + 单测
3. [x] 隔离库 mode 矩阵
4. [x] 复盘与报告
## 验收标准
- [x] live 时闭包不写;off/shadow 仍写
- [x] 生产仍保留 Bind / AddOnApprovedHook(mode=off 必需)
- [x] [E2 报告](../../test-reports/2026-09-15-event-e2-hook-guard-test-report.md)
## 相关链接
- Track E: [./2026-09-15-durable-event-track-e.md](./2026-09-15-durable-event-track-e.md)
- 复盘: [../research/2026-09-15-track-e-retrospective.md](../research/2026-09-15-track-e-retrospective.md)
@@ -1,54 +0,0 @@
---
title: "共享环境事件消费者 live 切换"
status: done
created: 2026-09-15
updated: 2026-09-15
owner: Cursor
branch: feature/event-shared-live-cutover
worktree: "-"
mutex: events
---
# 共享环境事件消费者 live 切换
## 目标
在共享 `agent-dev` 上按 notify → workflow_advance → projection 完成 shadow → drain → live → 回滚演练,再删除生产 hook 注册。
## 范围
- `scripts/event-consumer-mode.sh` + `cmd/eventmode`
- 共享 `agent_system_dev` inventory / quarantine
- 逐消费者 live 与授权页纵切(项目 6275;143 只读)
## 非目标
- FAV live
- test/main 环境
- 编辑 Phase 2 计划原文
- Track P(独立波次)
## 步骤
1. [x] L0 受控 SetMode 与 inventory
2. [x] L1 notify
3. [x] L2 workflow_advance
4. [x] L3 projection + 授权页
5. [x] L4 删除生产 hook 注册
## 验收标准
- [x] fav / test / main 切模式失败
- [x] 每消费者独立 live 报告
- [x] 生产代码无 `OnOutbox =` / `AddOnApprovedHook(`
## 相关链接
- Long-term: [.doc/archive/ops/2026-09-15-event-shared-live-cutover.md](../../archive/ops/2026-09-15-event-shared-live-cutover.md)
- Notify: [.doc/test-reports/2026-09-15-event-notify-shared-live-test-report.md](../../test-reports/2026-09-15-event-notify-shared-live-test-report.md)
- Advance: [.doc/test-reports/2026-09-15-event-workflow-advance-shared-live-test-report.md](../../test-reports/2026-09-15-event-workflow-advance-shared-live-test-report.md)
- Projection: [.doc/test-reports/2026-09-15-event-projection-shared-live-test-report.md](../../test-reports/2026-09-15-event-projection-shared-live-test-report.md)
## 证据 / 备注
已合入 `dev@39dc68d`。生产 hook 注册已删;方法本体保留一个窗口。
@@ -1,34 +0,0 @@
---
title: "共享环境事件消费者 live 切换"
status: done
created: 2026-09-15
updated: 2026-09-15
---
# 共享环境事件消费者 live 切换
## 动机
Track E 已在隔离库证明 notify / workflow_advance / projection 的 exactly-one visible outcome 与 E2 闭包守卫。共享集群仍为 `off`,HTTP 闭包仍是唯一真实写者。未 live 则不能删 hook API,也不能关闭 `DOC-RELIABILITY-PILOT`。
## 成功标准
- 按消费者独立:shadow coverage → drain → 原子 live;E2 守卫使对应闭包停写。
- 授权页刷新/重启正文与 head digest 一致;未授权不泄露。
- 回滚开关保留一个发布窗口后再删 `OnOutbox` / `AddOnApprovedHook`。
- FAV 保持 disabled;项目 143 只读。
## 依赖
- E0A–E2 已合入;隔离库报告已归档。
- 需要明确授权:动共享 `agent-dev` 消费者 mode。
## 暂不启动原因
已完成共享 live 与生产去注册。方法本体保留一个窗口。
## 相关链接
- [Track E 复盘](../research/2026-09-15-track-e-retrospective.md)
- [E2 报告](../../test-reports/2026-09-15-event-e2-hook-guard-test-report.md)
- [gap-matrix DOC-RELIABILITY-PILOT](../../remediation/gap-matrix.md)
@@ -1,39 +0,0 @@
---
title: "D7a intent 与 bizdev 解绑"
status: done
created: 2026-09-15
updated: 2026-09-15
owner: Cursor
branch: fix/intent-bizdev-boundary
worktree: "-"
mutex: intent
---
# D7a intent 与 bizdev 解绑
## 目标
intent 只依赖成熟度词汇叶子包,不再 import bizdev。
## 范围
- `internal/maturity`
- intent 生产与表征测试
- bizdev 类型别名保持兼容
## 非目标
- 不改识别规则
- 不迁 coordinator / chatflow(D5/D7b)
## 步骤
1. [x] 叶子包与别名
2. [x] intent 切断 bizdev
3. [x] 表征测试与 arch-check
4. [x] 报告
## 验收标准
- [x] intent 生产 import 无 bizdev
- [x] [S4a 报告](../../test-reports/2026-09-15-intent-bizdev-boundary-test-report.md)
@@ -1,50 +0,0 @@
---
title: "清点旁支并收口已合入本地分支"
status: done
created: 2026-09-15
updated: 2026-09-15
owner: Cursor
branch: chore/leftover-branch-cleanup
worktree: "-"
mutex: ops
---
# 清点旁支并收口已合入本地分支
## 目标
删除 tip 已是 `dev` 祖先的本地旁支与对应 worktree;不整支合入会回归或触红线的 5 条未合并分支;主仓跑一次 short 冒烟。
## 范围
- 拆 7 个已合入 worktree
- `git branch -d` 已 `--merged` 旁支
- CURRENT 记录故意保留的 FAV / herdr-removal / diagnosis / data-root / `dev-old-linear`
- vet / short / arch-check / health+ready
## 非目标
- 不整支 merge `feature/final-artifact-vault`;不启用 `FAV_DEGRADED_READ`
- 不合入 `feature/remove-herdr-agent-settings`(会回归 U12 arch-check、删 Herdr 脚本)
- 不合入 `fix/project143-controlled-content-404-diagnosis`(会回退审计关闭结果)
- 不合入 `fix/dev-runtime-data-root-guard`、`dev-old-linear`
- 不 push;不删 `origin/*`;不从 worktree 起 docker;不碰项目 143
## 步骤
1. [x] 占 CURRENT 集成槽
2. [x] 拆已合入 worktree
3. [x] 删除已 merged 本地旁支
4. [x] 冒烟并写报告
5. [x] 槽位 idle + archive
## 验收标准
- [x] 已合入旁支 worktree 只剩 FAV 错名目录
- [x] `--merged dev` 旁支已删(31 条)
- [x] 5 条未合入分支仍在
- [x] 测试报告 + health/ready schema 38
## 相关链接
- Test report: [../../test-reports/2026-09-15-leftover-branch-cleanup-test-report.md](../../test-reports/2026-09-15-leftover-branch-cleanup-test-report.md)
@@ -1,57 +0,0 @@
---
title: "审阅并修订模块解耦 Phase 2 方案"
status: done
created: 2026-09-15
updated: 2026-09-15
owner: Codex
branch: docs/module-decoupling-ipc-assessment
worktree: "-"
mutex: architecture-docs
---
# 审阅并修订模块解耦 Phase 2 方案
## 目标
以当前代码、migration、ADR 和 Phase 1 计划为证据,修正调研与 Phase 2 方案,并补齐高并发、互斥、权限、历史数据、灰度和回滚设计;不实施业务代码。
## 范围
- 复核调研报告与原 Phase 2 方案的事实、依赖和完成边界。
- 将事件可靠性、结构解耦、HTTP/PI 协议拆成独立轨道。
- 补充 PG 状态机、fencing、幂等、顺序、连接预算、权限、replay、脱敏、迁移和 browser/restart 验收。
- 同步 audit、remediation、CURRENT、FEATURE-MATRIX 与 gap-matrix。
## 非目标
- 不实现 dispatcher、consumer、migration 或协议代码。
- 不合并、部署、重启容器、删除数据或审计/合入 FAV 分支。
- 不把文档完成写成系统能力完成。
## 步骤
1. [x] 完成仓库启动链和上位 ADR/Phase 1 证据复核。
2. [x] 完成一致性、可行性、范围、安全、产品与对抗视角审阅。
3. [x] 修正调研报告中的 PG、依赖方向、allowlist 与进程边界事实。
4. [x] 重写 Phase 2 为 Track E/S/P,补齐详细实施和停走门。
5. [x] 同步索引与状态 SSOT。
6. [x] 执行文档链接、diff、冲突标记和术语检查。
## 验收标准
- [x] 调研不再把 SELECT-only Claim、MemoryBus 测试或 allowlist 基线写成生产闭环。
- [x] Track E 可独立关闭,FAV/D8/D9 不阻塞。
- [x] 方案明确 at-least-once 与 exactly-one visible outcome、最终提交点 fencing、集群级切换和授权模型。
- [x] 历史脏数据只分类/隔离/修复,不授权删除。
- [x] 文档状态一致且没有实施或发布声明。
## 相关链接
- Audit: [方案审阅](../../audit/2026-09-15-module-decoupling-phase2-plan-review.md)
- Remediation: [Phase 2 修订计划](../../remediation/2026-09-15-module-decoupling-ipc-phase2-remediation-plan.md)
- Research: [IPC/RPC 现状评估](../../ops/research/2026-09-15-module-decoupling-ipc-assessment.md)
- Test report: 不适用(文档审阅,无业务实现)
## 证据 / 备注
本任务沿用用户已创建的 `docs/module-decoupling-ipc-assessment` 分支。该分支名早于当前 `feature/*|fix/*` 规则;未改写或重命名用户分支。起点提交为 `a3392e3` 与 `5cef856`,本轮未获授权 commit/push。
@@ -1,47 +0,0 @@
---
title: "PI typed-result-v1 P1–P4"
status: done
created: 2026-09-15
updated: 2026-09-15
owner: Cursor
branch: feature/pi-typed-result
worktree: "-"
mutex: pi-agent
---
# PI typed-result-v1 P1–P4
## 目标
Runner additive 输出 `result_v1`;Go typed-first fail-closed;共享 dev 真实 PI 双轨对账;去掉 stderr/legacy 明文错误。
## 范围
- `configs/schemas/pi-run-result-v1.json`
- `deploy/pi-agent/result-v1.mjs` + runner 接线
- `internal/agent` parser / 负例 / `RUN_PI_E2E=1` 双轨
## 非目标
- 不把 member 正文搬进 `result_v1`(仍走 `patches[]`)
- 不改 HTTP 状态码;不启用 FAV;不写项目 143
## 步骤
1. [x] Schema + Runner additive
2. [x] Go typed-first + handshake
3. [x] 真实 PI 双轨
4. [x] 删 stderr/隐式 legacy;报告与合入
## 验收标准
- [x] typed-present-invalid 永不 fallback
- [x] handshake downgrade 负例 PASS
- [x] `RUN_PI_E2E=1` 成功/失败/取消/超时对账
- [x] test-report 归档
## 相关链接
- Test report: `.doc/test-reports/2026-09-15-pi-typed-result-v1-test-report.md`
- Remediation: `.doc/remediation/2026-09-15-pi-typed-result-v1-remediation.md`
- P0: `.doc/ops/research/2026-09-15-pi-typed-result-p0-matrix.md`
@@ -1,45 +0,0 @@
---
title: "晋升 dev → test 并部署测试环境"
status: in_progress
created: 2026-09-15
updated: 2026-09-15
owner: Cursor
branch: feature/promote-dev-to-test-2026-09-15
worktree: "-"
mutex: infra
---
# 晋升 dev → test 并部署测试环境
## 目标
把已完成的 Phase 2 代码从本地 `dev` 合入 `test`,重建并冒烟测试环境,供人工实测。不实施多意图 HITL。
## 范围
- `test` 分支 `--no-ff` 合入当前 `dev`
- `./scripts/env-service.sh test rebuild`
- test 库 notify/workflow_advance/projection 切 live(L4 去 hook 后 off 会停写);FAV 保持 off
## 非目标
- 不实施多意图 HITL U1+
- 不合入 `main`、不启用 FAV
- 不写项目 143
## 步骤
1. [x] 确认 Phase 2 已在本地 `dev`
2. [ ] occupy 集成槽并合入 `test`
3. [ ] rebuild 测试服务
4. [ ] health/ready + schema 冒烟
## 验收标准
- [ ] `:8081` health/ready PASS
- [ ] events `:8089` health PASS
- [ ] FAV 仍 off
## 相关链接
- CURRENT: `.doc/ops/CURRENT.md`
@@ -1,40 +0,0 @@
---
title: "D5 stageflow 类型归属与 D7b chatflow 首批"
status: done
created: 2026-09-15
updated: 2026-09-15
owner: Cursor
branch: fix/stageflow-type-ownership
worktree: "-"
mutex: stageflow
---
# D5 stageflow 类型归属与 D7b chatflow 首批
## 目标
coordinator 生产代码不再 import bizdev;task/stage 请求走 stageflow 类型;chatflow assembler 改用 maturity。
## 范围
- stageflow 类型别名与状态常量
- coordinator 构造改为 StageTaskRunner + ContextServices
- chatflow 去掉 bizdev import
## 非目标
- 不复制行为方法成 DTO(身份别名 + token golden)
- 不删除 bizdev 八个 getter(D4)
- 不搬空 chat 包
## 步骤
1. [x] 类型边界与 coordinator 解绑
2. [x] chatflow assembler
3. [x] 表征测试与 arch-check
4. [x] 报告
## 验收标准
- [x] coordinator 生产 import 无 bizdev
- [x] [S2/S4b 报告](../../test-reports/2026-09-15-stageflow-type-ownership-test-report.md)
@@ -1,60 +0,0 @@
---
title: "M3 U8 TaskRun 终态与 RunManifest"
status: done
created: 2026-09-15
updated: 2026-09-15
owner: Cursor
branch: feature/taskrun-runmanifest
worktree: "-"
mutex: taskrun
---
# M3 U8 TaskRun 终态与 RunManifest
## 目标
TaskRun 终态在同一 UoW 内 CAS 写入唯一合法状态,并持久化类型化 RunManifest;重复 finalize / cancel race / SSE 断线不得产生第二条助手消息或第二份 artifact;workspace 清理仅在 verified receipt 之后。
## 范围
- Goose 00037 `task_run_manifests` + `finalizing` 状态
- `internal/taskrun` RunManifest 规范字节 / SHA / members
- `taskrun.Commands.Finalize` 唯一 finalize 命令;server 变薄
- `ctxmgr.FinalizeAssistantTaskMessage` 仅此写路径加入 UoW
- workspace 清理门禁;`ReadArtifact` 替代 `Join(workDir, "output.md")`
- BackendRef 服务端 policy;隔离库并发测试;占槽 rebuild;U8 报告
## 非目标
- U9 backfill / corpus / 八轨 / 销毁
- M4–M6;整支 merge FAV;启用 `FAV_DEGRADED_READ`
- 终止或改写项目 143
- 动 `chat` / `intent` 刷新任务
- worktree 内 `env-service`
## 步骤
1. [x] CURRENT 认领 `mutex=taskrun`;从本地 `dev` 开 `feature/taskrun-runmanifest`
2. [x] Goose 00037 Up+Down;`module-boundaries.yaml` 表属主
3. [x] Finalize 同 UoW:CAS + 助手 turn + manifest + envelope/staging
4. [x] 清理门禁与 server 去路径、BackendRef
5. [x] 隔离库双 pool / race;占槽 rebuild;报告最后一句只能「继续 U9」或「停止扩面」
## 验收标准
- [x] 重复 finalize:同一 status、同一 manifest SHA、助手消息 1 条、envelope/staging 不加倍
- [x] finalize ∥ cancel:恰好一个合法终态
- [x] SSE `done` 不出现在 TX 失败路径;commit 前断线重试不第二 turn
- [x] 无 verified receipt 则 cleanup FAIL;有 receipt 则可清 workspace 且 staging 仍能取出原 SHA
- [x] 报告最后一句为「继续 U9」或「停止扩面」;U9 清单项保持未勾
## 相关链接
- Checklist: [2026-09-14-module-decoupling-refactor-acceptance.md](../checklists/2026-09-14-module-decoupling-refactor-acceptance.md)
- Remediation: [2026-09-14-module-decoupling-refactor-plan.md](../../remediation/2026-09-14-module-decoupling-refactor-plan.md)
- 权威停走门: [2026-09-14-document-reliability-m2-test-report.md](../../test-reports/2026-09-14-document-reliability-m2-test-report.md)(继续 M3)
- Test report: [2026-09-15-taskrun-runmanifest-u8-test-report.md](../../test-reports/2026-09-15-taskrun-runmanifest-u8-test-report.md)
## 证据 / 备注
未签字前禁止 U9–U12。合入 + 容器测占集成槽,主仓 `./scripts/env-service.sh dev rebuild`。
@@ -1,31 +0,0 @@
---
title: "Track P 协议实施(信封与 typed-result)"
status: done
created: 2026-09-15
updated: 2026-09-15
---
# Track P 协议实施(信封与 typed-result)
## 动机
H0/P0 盘点后独立实施 HTTP 信封与 PI typed-result,不回退事件 live。
## 成功标准
已关闭:
- [HTTP 信封 H1–H3](../../test-reports/2026-09-15-http-error-envelope-h1-h3-test-report.md)
- [PI typed-result P1–P4](../../test-reports/2026-09-15-pi-typed-result-v1-test-report.md)
## 依赖
mutex `server`/`web`/`pi-agent` 已释放。
## 暂不启动原因
已完成。
## 相关链接
- [Phase 2 计划](../../remediation/2026-09-15-module-decoupling-ipc-phase2-remediation-plan.md)
@@ -1,55 +0,0 @@
---
title: "PU6 语义摘要 shadow(SEMANTIC_SUMMARY_SHADOW)"
status: done
created: 2026-09-16
updated: 2026-09-16
owner: Cursor-Auto
branch: feature/pu6-semantic-summary
worktree: ".worktrees/feature-pu6-semantic-summary"
mutex: chat
---
# PU6 语义摘要 shadow
## 目标
在授权可见消息集合上落地 `SEMANTIC_SUMMARY_SHADOW`(默认 off):shadow 语义摘要、失败回 deterministic 并标注 freshness;不启用 REPLACE。
## 范围
- `internal/ctxmgr/summarizer.go` + semantic shadow
- `internal/app/chatflow/` 授权过滤入口
- `internal/server/chat_digest_api.go` 出站 freshness/shadow 字段
- 单元/表征测试;测试报告
## 非目标
- 不启用 `SEMANTIC_SUMMARY_REPLACE`
- 不合入 `dev`
- 不改 plan 文件
## 步骤
1. [x] 从 `dev` 开分支 / worktree 并认领
2. [x] flags + 无工具语义摘要器 + rolling summary shadow
3. [x] chatflow 授权路径 + digest API
4. [x] 测试与报告
5. [x] 渐进提交并 push
## 验收标准
- [x] flag off 行为与基线一致
- [x] shadow on:仅 authorized 消息;失败保留 deterministic + freshness
- [x] injection 不能提权;REPLACE 路径未接线
- [x] 测试报告归档
## 相关链接
- Contract: `../long-term/2026-09-16-pu6-semantic-summary-contract.md`
- Test report: `../../test-reports/2026-09-16-pu6-semantic-summary-test-report.md`
## 证据 / 备注
- 分支:`feature/pu6-semantic-summary`(worktree)
- 测试:`go test -short ./internal/ctxmgr/ ./internal/app/chatflow/ ./internal/server/` PASS
@@ -1,48 +0,0 @@
---
title: "P5 PU8 U9–U12 独立 flag 脚手架"
status: done
created: 2026-09-16
updated: 2026-09-16
owner: Cursor
branch: feature/pu8-u9-u12-flags
worktree: /tmp/wt-pu8
mutex: intent-plan
---
# P5 PU8 U9–U12 独立 flag 脚手架
## 目标
为多意图扩面 U9–U12 落地独立 env flag(默认 OFF)与 stub/dry-run 端口,不升 `MULTI_INTENT_PLAN_TIER`。
## 范围
- `MULTI_INTENT_U9_SEGMENT` / `U10_MUTATE` / `U11_DOCGOV` / `U12_RUN_CONTROL`
- U9 segment proposal port + fail-closed stub
- U10–U12 dry-run adapters + `BuildOwnerMux` 门控
- 单测证明默认 off 与 enable 路径不 panic
## 非目标
- 真实 LLM 分段 / 升 tier / 合入 `dev`
- 真实 docgov/workflow 副作用写路径
## 步骤
1. [x] 独立 flags + `.env.example`
2. [x] segment proposal + expansion adapters + mux 门控
3. [x] Assemble `BuildOwnerMux` 接线
4. [x] 单测 + 测试报告
5. [x] push(不合 `dev`)
## 验收标准
- [x] 四 flag 默认 off;开 flag 不升 PlanTier
- [x] flag off ≡ legacy(无 LLM proposal、无新 adapters)
- [x] flag on:U9 fail-closed;U10–U12 dry-run/guarded
- [x] 报告归档
## 相关链接
- Contracts: [u9](../long-term/2026-09-16-pu8-u9-segment-proposal-contract.md) … [u12](../long-term/2026-09-16-pu8-u12-workflow-run-control-contract.md)
- Test report: [../../test-reports/2026-09-16-pu8-u9-u12-flags-test-report.md](../../test-reports/2026-09-16-pu8-u9-u12-flags-test-report.md)
@@ -1,30 +0,0 @@
---
title: "Wave 2 PU4 真实 PI 补证(U8 + full/none)"
status: done
created: 2026-09-16
updated: 2026-09-16
owner: Cursor
branch: feature/wave2-real-pi-evidence
worktree: "-"
mutex: intent-plan
---
# Wave 2 PU4 真实 PI 补证(U8 + full/none)
## 目标
补齐 multi-intent U8 与工作流 full/none 的真实 PI / PG / 跨用户 / 恢复证据。
## 步骤
1. [x] 认领 + 占槽 rebuild
2. [x] U8 live 证据路径
3. [x] full/none 混合长链 live 测试
4. [x] 报告 + 矩阵更新 + 释放槽位
## 验收标准
- [x] U8 真实 PI PASS
- [x] full 跨用户审批 PASS
- [x] none 免审批且不阻塞 PASS
- [x] 报告归档 `.doc/test-reports/2026-09-16-wave2-real-pi-evidence-test-report.md`
@@ -1,48 +0,0 @@
---
title: "docgov 变更提案 HTTP + 前端接线"
status: done
created: 2026-09-17
updated: 2026-09-17
owner: Cursor
branch: feature/docgov-modification-proposal-http
worktree: .worktrees/feature-docgov-modification-proposal-http
mutex: docgov
---
# docgov 变更提案 HTTP + 前端接线
## 目标
暴露 `POST /api/v1/docgov/proposal`,前端「修改」快捷分支与 `ProposalConfirmCard` 走真实 propose/decide,不再本地假装成功。
## 范围
- API:`ProposeModification` 路由;decide 补 404/403 映射
- 前端:`docgov.ts` + `App.tsx` 接线
- 单测 + 真实 HTTP 证据
- 关闭 audit 缺口;dev 试点总开关证据归档
## 非目标
- 晋升 test/main
- 变更提案自动改写受控正文(批准后仍为 UI 演示增补)
## 步骤
1. [x] 实现 propose handler + 路由
2. [x] 前端 client + App 接线
3. [x] handler/client 单测
4. [x] 合入 dev + rebuild + 真实 HTTP
5. [x] push origin/dev;清理 author-only worktree
## 验收标准
- [x] `POST /api/v1/docgov/proposal` 可写库(单测)
- [x] 真实 HTTP claim → propose → decide PASS
- [x] audit 缺口 resolved;CURRENT 认领收敛
## 相关链接
- Audit: [../../audit/2026-09-17-docgov-modification-proposal-http-gap.md](../../audit/2026-09-17-docgov-modification-proposal-http-gap.md)
- Pilot: [../../test-reports/assets/2026-09-17-author-only-pilot/](../../test-reports/assets/2026-09-17-author-only-pilot/)
- Closeout: [../handoffs/2026-09-17-document-author-only-closeout.md](../handoffs/2026-09-17-document-author-only-closeout.md)
@@ -1,53 +0,0 @@
---
title: "修复 CreateOrGetDocument 可选职责 0→NULL FK"
status: done
created: 2026-09-17
updated: 2026-09-17
owner: Cursor
branch: fix/docgov-optional-duty-null-fk
worktree: "-"
mutex: docgov
---
# 修复 CreateOrGetDocument 可选职责 0→NULL FK
## 目标
无 reviewer/approver 职责时创建文档账本成功,不再因 `reviewer_id=0` FK 失败并被标成 `INTERNAL_ERROR`。
## 范围
- `internal/docgov/engine.go`:`nullIfZero` 写入 author/reviewer/approver
- `internal/stream/classify.go`:`DOC_LEDGER_ERROR` 分型
- 回归测试 + audit/test-report
## 非目标
- 不强制项目配置 reviewer
- 不改前端 flushSync / 虚拟列表
- 不改项目 6417 存量数据(代码修好后重试即可)
## 步骤
1. [x] CreateOrGetDocument 0→NULL
2. [x] ClassifyError `DOC_LEDGER_ERROR`
3. [x] 单元/回归测试(`-short` 已绿)
4. [x] 占集成槽位 rebuild + 6417 复测(`run_1789625396102207018`,`doc_proj6417_intake` NULL FK)
5. [x] test-report 归档;合入 `dev`
## 验收标准
- [x] `go test -short ./internal/docgov/... ./internal/stream/...` PASS
- [x] 仅-author 项目 `CreateOrGetDocument` / 任务发起不再 `INTERNAL_ERROR`;`reviewer_id IS NULL`
- [x] 项目 6417 账本创建成功(full 职责路径未被本修复改动)
## 相关链接
- Audit: [../../audit/2026-09-17-docgov-optional-duty-null-fk.md](../../audit/2026-09-17-docgov-optional-duty-null-fk.md)
- Test report: [../../test-reports/2026-09-17-docgov-optional-duty-null-fk-test-report.md](../../test-reports/2026-09-17-docgov-optional-duty-null-fk-test-report.md)
## 证据 / 备注
- 失败 run:`run_1789622069585300787`
- 验证 run:`run_1789625396102207018` / `doc_proj6417_intake` author=9 reviewer/approver NULL
- merge:`e488d10 merge: fix/docgov-optional-duty-null-fk`
@@ -1,47 +0,0 @@
---
title: 文档编制人兼任审核批准方案
status: done
created: 2026-09-17
updated: 2026-09-17
owner: Codex
branch: feature/document-author-only-plan
worktree: .worktrees/feature-document-author-only-plan
mutex: document-duty-policy-plan
---
# 文档编制人兼任审核批准方案
## 目标
基于当前源码形成管理员总授权、项目创建者逐文档选择的详细实施方案,交用户审核。
## 范围
权限、系统设置、工作流规划和冻结、文档三职、动作鉴权、状态机、前端、迁移与验收。
## 非目标
本次不修改业务代码、不变更数据库或共享容器、不推送。
## 步骤
1. [x] 阅读启动链并从本地 dev 建立隔离分支。
2. [x] 核查实现并记录证据。
3. [x] 编写方案、检查边界与验收覆盖。
## 验收标准
- [x] 方案覆盖用户两个权限层级及逐文档持久化。
- [x] 当前事实与拟议行为分开,列明实施单元与测试场景。
## 证据 / 备注
基线 dev adb48c8。已 fetch origin/dev,本地 dev 领先 44、落后 0,保留未推送集成成果;主工作区 feature/control-center-server 未切换。worktree 脚本默认从当前 HEAD 创建,故直接指定 dev 创建本 worktree,避免引入他人分支。
## 交付
- 方案:`.doc/remediation/2026-09-17-document-author-only-plan.md`
- 核查:`.doc/audit/2026-09-17-document-author-only-analysis.md`
- 本任务完成仅指方案交付,业务实现为 planned;R9/R10 待用户审核。
- 未合入 dev:方案保留在独立分支供审核;未推送、未修改业务代码或容器。
- 验证:源码与文档一致性检查、git diff --check;未执行业务测试。
@@ -1,57 +0,0 @@
---
title: "文档编制人兼任:U1 策略存储与总授权"
status: done
created: 2026-09-17
updated: 2026-09-17
owner: Cursor
branch: feature/document-author-only-plan
worktree: ".worktrees/feature-document-author-only-plan"
mutex: sysadmin + document-duty-policy
---
# 文档编制人兼任:U1 策略存储与总授权
## 目标
落地 `workflow.allow_author_only_approval` 管理员总开关:默认关闭、严格 bool、revision CAS、事务内审计,并向 projectinstance 提供可参与激活事务的窄读取接口。
## 范围
- Goose 增量迁移(revision 列、种子行、策略审计表)
- `internal/sysadmin` 存储/服务/窄 Policy 接口
- `admin_system_handlers` 对本 key 的 `expected_revision` 协议
- 单元 / PG / HTTP 负例测试
## 非目标
- 逐文档 duty_policy(U2)
- 前端设置页文案(U5)
- 已激活实例紧急熔断
## 步骤
1. [x] 认领 CURRENT
2. [x] 迁移 00050
3. [x] sysadmin CAS + 审计 + PolicySource
4. [x] admin handler
5. [x] 测试与提交
## 验收标准
- [x] 管理员可开关;非管理员 403
- [x] null/字符串布尔拒绝
- [x] 并发 CAS 仅一版成功
- [x] 审计失败回滚设置
- [x] 窄接口可读 allowed+revision;缺行默认 false;DB 故障不伪装
## 相关链接
- Plan: `.doc/remediation/2026-09-17-document-author-only-plan.md` U1
- Checklist:
## 证据 / 备注
- `go test ./internal/sysadmin/ ./internal/server/ -run 'Settings|AuthorOnly|PGSettings|AdminSystem'` PASS
- `go test -short ./internal/sysadmin/ ./internal/server/` PASS
- Key: `workflow.allow_author_only_approval`
- 窄接口: `sysadmin.AuthorOnlyPolicySource`
@@ -1,54 +0,0 @@
---
title: "文档编制人兼任:U2 逐文档模式与激活"
status: done
created: 2026-09-17
updated: 2026-09-17
owner: Cursor
branch: feature/document-author-only-plan
worktree: ".worktrees/feature-document-author-only-plan"
mutex: projectinstance + document-duty-policy
---
# 文档编制人兼任:U2 逐文档模式与激活
## 目标
落地逐文档 `duty_policy=author_only`:规划校验、预览摘要、激活 token 绑定策略 revision,激活事务内行锁串行化关闭总开关。
## 范围
- DocTaskPlan / PreviewSummary / ProjectSettings 扩展
- ResolveDocTaskDuty、Save/Preview/Activate 消费 U1 策略
- Goose 00051 token revision 列
- app 适配器装配、HTTP 错误码映射
- 单元测试
## 非目标
- Heal/文档投影(U3)
- 前端 UI(U5)
- 运行时动作多职责(U4/U6)
## 步骤
1. [x] 类型与解析器
2. [x] service/store/迁移
3. [x] app 装配与 handler
4. [x] 测试与提交
## 验收标准
- [x] 一位成员兼任可存/预览/激活(总开关开)
- [x] 总开关关时 Save 拒绝
- [x] 预览后 revision 变化旧 token 409
- [x] 未开模式只填作者仍 partial 拒绝
- [x] 旧快照缺 duty_policy 时 hash 稳定
## 相关链接
- Plan: `.doc/remediation/2026-09-17-document-author-only-plan.md` U2
## 证据 / 备注
- `go vet ./internal/projectinstance/ ./internal/app/ ./internal/server/`
- `go test -short ./internal/projectinstance/ ./internal/server/ ./internal/app/` PASS
@@ -1,55 +0,0 @@
---
title: "文档编制人兼任:U3 文档绑定与职责投影"
status: done
created: 2026-09-17
updated: 2026-09-17
owner: Cursor
branch: feature/document-author-only-plan
worktree: ".worktrees/feature-document-author-only-plan"
mutex: docgov + docduty + bizdev + document-duty-policy
---
# 文档编制人兼任:U3 文档绑定与职责投影
## 目标
生成时写入实例治理职责并 `duty_locked`;heal/revoke 跳过锁定行;读侧投影 `duty_policy`。
## 范围
- Goose 00052:`document_records.duty_locked` / `duty_policy`
- `docgov.LockDocumentDuty` + 列表投影
- `docduty` heal/revoke `AND NOT duty_locked`
- `bizdev.InstanceDutySource` + `resolveTaskDocumentDuties` 治理分支;跳过 governed 内存 heal
- `app/instance_duty_adapter.go` 装配
## 非目标
- U4 动作鉴权 / allowed_actions
- U5/U6 前端
- 合入 `dev`
## 步骤
1. [x] 迁移
2. [x] docgov / docduty
3. [x] bizdev + app 适配器
4. [x] 测试与提交
## 验收标准
- [x] 受治理文档创建后 `duty_locked=true` 且三职来自实例
- [x] heal/revoke 不清锁定行(SQL 过滤 + 单测/PG 可选)
- [x] 生成后 governed 路径不再用项目默认覆盖内存态
- [x] 模块边界:bizdev/docduty/docgov 不导入 projectinstance
## 相关链接
- Plan: U3(文档绑定与职责投影一致性)
- 依赖:U1 `3b6def2`、U2 `c03d0a3`
## 证据 / 备注
- `go vet ./internal/docgov/ ./internal/docduty/ ./internal/bizdev/ ./internal/app/ ./internal/projectinstance/`
- `go test -short` 上述包 PASS
- PG:`TEST_DATABASE_URL` 未配置时 `Heal/Revoke SkipsDutyLocked` 自动跳过
@@ -1,47 +0,0 @@
---
title: "文档编制人兼任:U4 动作鉴权与审计"
status: done
created: 2026-09-17
updated: 2026-09-17
owner: Cursor
branch: feature/document-author-only-plan
worktree: ".worktrees/feature-document-author-only-plan"
mutex: projectinstance + docgov + document-duty-policy
---
# 文档编制人兼任:U4 动作鉴权与审计
## 目标
ABAC 门禁识别 `duty_policy=author_only` 派生职责;审计 Details 携带 duty_policy。
## 范围
- `duty_action` / `stage_access` / `gate` 改用 `ResolveDocTaskDuty`
- `state_machine` Transition* Details 补 `duty_policy`
- author_only 动作矩阵与阶段可见性测试
## 非目标
- U5 UI / U6 浏览器闭环
## 步骤
1. [x] ABAC 三文件
2. [x] 审计详情
3. [x] 测试与提交
## 验收标准
- [x] author_only 规范存储(仅 Author ID)下 A 可 run/edit/submit/review/approve
- [x] 非 A 拒绝;阶段门禁将 author_only 视为 approvalManaged
- [x] 审计 Details 含 duty_policy
## 相关链接
- Plan: U4+U5 实施计划
- 依赖:U1–U3
## 证据 / 备注
- `go test -short ./internal/projectinstance/ ./internal/docgov/ ./internal/app/ ./internal/server/` PASS
@@ -1,48 +0,0 @@
---
title: "文档编制人兼任:U5 系统设置与逐文档 UI"
status: done
created: 2026-09-17
updated: 2026-09-17
owner: Cursor
branch: feature/document-author-only-plan
worktree: ".worktrees/feature-document-author-only-plan"
mutex: web + document-duty-policy
---
# 文档编制人兼任:U5 系统设置与逐文档 UI
## 目标
前端识别 `duty_policy` / `author_only_policy`;项目设置可逐文档开启兼任。
## 范围
- `projectSettings.ts` 类型
- `projectSettingsDuties.ts` resolveClientDocTaskDuty + 校验
- `ProjectSettingsModal` 兼任勾选与预览
- SettingsSection 不改(白名单通用渲染)
## 非目标
- U6 多职责动作栏 / 浏览器 E2E
## 步骤
1. [x] 类型与 lib
2. [x] UI
3. [x] 测试与提交
## 验收标准
- [x] author_only 客户端校验通过且不计三人门槛
- [x] 总开关关闭时兼任勾选禁用并提示
- [x] 预览展示兼任文档计数
## 相关链接
- Plan: U4+U5 实施计划
## 证据 / 备注
- `npx tsc --noEmit` PASS
- `npm test` PASS(含 projectSettingsDuties author_only 用例)
@@ -1,55 +0,0 @@
---
title: "文档编制人兼任:U6 多职责动作与真实闭环"
status: done
created: 2026-09-17
updated: 2026-09-17
owner: Cursor
branch: feature/document-author-only-plan
worktree: ".worktrees/feature-document-author-only-plan"
mutex: web + document-duty-policy
---
# 文档编制人兼任:U6 多职责动作与真实闭环
## 目标
去掉 author-first 动作短路,把认领/送审/审核/批准接到真实 docgov HTTP,完成 author_only 端到端验收。
## 范围
- `web/src/api/docgov.ts` 四接口客户端
- `docGovActionVisibility` / `holdsDocDuty`
- `App.tsx` 真实 handler + 快捷指令
- `duty_policy` 透传与「编制人兼任」徽标
- 单测 + 真实闭环报告
## 非目标
- 变更提案 HTTP 路由(另记 audit)
- 合入 `dev` / 推送远端(未授权不推)
## 步骤
1. [x] API 客户端
2. [x] ID 直判可见性
3. [x] App 接线 + 驳回批准修正
4. [x] duty_policy 徽标透传
5. [x] 单测 / tsc
6. [x] 真实闭环与报告
## 验收标准
- [x] author_only 下 A 可见三动作;非 A 403
- [x] 真实 API 闭环写库与审计含 duty_policy
- [x] 浏览器可见「编制人兼任」徽标
- [x] 测试报告归档
## 相关链接
- Test report: [../../test-reports/2026-09-17-document-author-only-u6-test-report.md](../../test-reports/2026-09-17-document-author-only-u6-test-report.md)
- Remediation U6: [../../remediation/2026-09-17-document-author-only-plan.md](../../remediation/2026-09-17-document-author-only-plan.md)
## 证据 / 备注
- `npm test` 390 pass;`tsc --noEmit` clean
- assets: `test-reports/assets/2026-09-17-document-author-only-u6/`
@@ -1,41 +0,0 @@
---
title: "首次加载性能诊断与改进方案"
status: done
created: 2026-09-17
updated: 2026-09-17
owner: Codex
branch: feature/initial-load-performance-plan
worktree: .worktrees/feature-initial-load-performance-plan
mutex: loading-performance-audit
---
# 首次加载性能诊断与改进方案
## 目标
以源码、现有容器静态资源和只读浏览器测量定位首次加载瓶颈,输出可审核的分期改进方案。
## 范围
登录前首屏、登录后初始化、项目/文档首次打开、静态资源交付;区分事实与待验证假设。
## 非目标
不修改业务代码,不重启/重建共享服务,不触发真实对话或文档写任务,不提交或推送其他人的工作。
## 步骤
1. [x] 阅读仓库启动链;独立 dev 基线 worktree,主仓保留其他 Agent 分支。
2. [x] 采集数值基线和源码证据。
3. [x] 写 audit 和 remediation,同步 CURRENT,归档任务。
## 验收标准
- [x] 原因有文件位置或运行时测量支持,未覆盖环境明确标注。
- [x] 方案包含优先级、改动边界、性能预算、回归门禁和回滚。
## 证据 / 备注
仅诊断与方案,不代表优化已实施。fetch 后 origin/dev 落后本地 dev;不拉回或覆盖本地工作。worktree 从创建瞬间的 dev 建立。
## 交付
- 诊断:`.doc/audit/2026-09-17-initial-load-performance-audit.md`
- 方案:`.doc/remediation/2026-09-17-initial-load-performance-plan.md`
- 报告:`.doc/test-reports/2026-09-17-initial-load-performance-baseline.md`
- 本轮仅方案;没有业务代码、没有部署、未提交、未合dev、未推送。主仓仅同步本任务认领。
- 临时3199 Vite已停止;既有3100/8080/8081未重启。未占集成槽。
@@ -1,55 +0,0 @@
---
title: "修复 KB 宿主机错误口令与静默离线降级"
status: done
created: 2026-09-17
updated: 2026-09-17
owner: Cursor
branch: fix/kb-host-auth-layered-load
worktree: "-"
mutex: infra
---
# 修复 KB 宿主机错误口令与静默离线降级
## 目标
消除 `config.Load("")` 只读 `configs/.env.dev`、忽略根 `.env` 的 `KB_DB_PASSWORD` 导致的错误默认口令与静默离线;E2E/nightly 默认 fail-closed。
## 范围
- `internal/config` 分层加载 + 宿主机 DNS 归一化 + 空默认口令
- `internal/kb` 脱敏日志、`Online()`、`KB_REQUIRE_ONLINE` / `KB_ALLOW_OFFLINE`
- `/health` 增加 `kb_ready`
- PI E2E helper 与 `scripts/run-nightly-real-pi.sh` 预检
- env 模板与验收报告
## 非目标
- 不改 KB 数据内容 / 法规迁移
- 不把真实口令写入 git 跟踪的 `configs/.env.*`
- 不把容器内 DNS 改成 localhost
## 步骤
1. [x] 分层 Load + 默认口令清空
2. [x] NormalizeKBHostForRuntime
3. [x] kb 客户端脱敏 + RequireOnline(EnsureOnline;不 Fatalf)
4. [x] health `kb_ready` + E2E/nightly 门禁
5. [x] 合入 `dev` 冒烟(rebuild + `/health` `kb_ready=true`)
## 验收标准
- [x] `config.Load("")` 分层合并后口令来自根 `.env`(单测临时文件 + live 布尔校验)
- [x] 宿主机 `shuimu-kb-shared` → `127.0.0.1`;容器内保留 compose DNS
- [x] 错口令/空口令离线且日志无明文密码;`KB_ALLOW_OFFLINE=1` 可降级
- [x] 合 `dev` 后 short 测 PASS;dev rebuild 后 `kb_ready=true`,日志 `online=true dsn=...:***@shuimu-kb-shared...`,无 `shared_kb_secret_pass`
## 相关链接
- Test report: `.doc/test-reports/2026-09-17-kb-host-auth-layered-load-test-report.md`
- Plan: 修复 KB 连接降级
## 证据 / 备注
根因:`Load` 优先单文件 `configs/.env.dev`(故意省略 `KB_DB_PASSWORD`),保留错误默认 `shared_kb_secret_pass`;Compose 本已分层,宿主机 `go test` 未对齐。
合入后容器日志:`[kb] online=true dsn=postgres://regkb:***@shuimu-kb-shared:5432/regulations?sslmode=disable`;health `kb_ready=true`。
@@ -1,57 +0,0 @@
---
title: "rdev 模板深度补强 S1 续批(剩余 46 份)"
status: done
created: 2026-09-17
updated: 2026-09-17
owner: Cursor
branch: feature/rdev-template-depth-s1-continued
worktree: ".worktrees/feature-rdev-template-depth-s1-continued"
mutex: rdev-templates
---
# rdev 模板深度补强 S1 续批(剩余 46 份)
## 目标
将剩余 46 份 `rd_*` 模板按写作规范做同等深度补强,lint allowlist 扩至全 60 份,抽样真 PI 打样收口。
## 范围
- 批1:6 份评审记录
- 批2:阶段06 硬件/工艺 8 份
- 批3:阶段06 软件/检验/技术要求+清单 9 份
- 批4:阶段08 验证 12 份
- 批5:阶段10–13 转换/确认 11 份
- lint allowlist + 抽样真 PI + 文档同步
## 非目标
- S2/S3、P2 前端、P3 三样本全量 E2E、P4 键名空间化
- 晋升 test/main
## 步骤
1. [x] 批1 评审记录 6 份
2. [x] 批2 硬件/工艺 8 份
3. [x] 批3 软件/检验/清单 9 份
4. [x] 批4 验证 12 份
5. [x] 批5 转换/确认 11 份
6. [x] 抽样真 PI + 文档同步(合入 push 见 merge 步骤)
## 验收标准
- [x] 46 份无「按本阶段专业结构写」;lint allowlist 60/60
- [x] 抽样 1–2 份真 PI PASS(`rd_planning_review` + `rd_design_vv`,项目 6446)
- [x] FEATURE-MATRIX / 写作规范 / backlog 已更新
## 相关链接
- Backlog: [.doc/backlog/2026-09-17-rdev-phase2-backlog.md](../../backlog/2026-09-17-rdev-phase2-backlog.md)
- 写作规范: [.doc/system-design/project-workflow/08-rdev模板写作规范.md](../../system-design/project-workflow/08-rdev模板写作规范.md)
- 首批报告: [.doc/test-reports/2026-09-17-rdev-template-depth-test-report.md](../../test-reports/2026-09-17-rdev-template-depth-test-report.md)
- 续批报告: [.doc/test-reports/2026-09-17-rdev-template-depth-s1-continued-test-report.md](../../test-reports/2026-09-17-rdev-template-depth-s1-continued-test-report.md)
## 证据 / 备注
- 资产:`.doc/test-reports/assets/2026-09-17-rdev-template-depth-s1-continued/`
- 附带:`fix(projectinstance): allocate next instance_no for planning drafts`
@@ -1,54 +0,0 @@
---
title: "rdev 模板深度补强 S0 + S1 首批"
status: done
created: 2026-09-17
updated: 2026-09-17
owner: Cursor
branch: feature/rdev-template-depth
worktree: ".worktrees/feature-rdev-template-depth"
mutex: rdev-templates
---
# rdev 模板深度补强 S0 + S1 首批
## 目标
修复 rdev leader prompt 错配,并为阶段 01–05 的 14 份 rdev 模板补齐 ISO 13485 专业章节与逐节写作指令,以 dev 真实 PI 打样验证收口。
## 范围
- S0.1 B1:`rdev_leader.md` + InstructionsFile 注入链
- S0.2:`rd_design_input_spec` 样例 + 写作规范 + lint
- S0.3:dev 真实 PI 打样
- S1 首批:阶段 01–05 共 14 份模板(分 3 批)
## 非目标
- overlay 机制本体、R1–R7 二期、per-stage 步骤定制、模型配置化、manifest 元数据、前端(P2)、键名空间化(P4)、阶段 06–13 模板
## 步骤
1. [x] S0.1 leader prompt 注入链(`6a09062`)
2. [x] S0.2 样例模板 + 规范 + lint(含于 `eb09b21`)
3. [x] S0.3 真实 PI 打样(项目 6424 intake + 6425 `rd_design_input_spec`)
4. [x] S1 批 1–3(`eb09b21`)
5. [x] 文档与门禁
## 验收标准
- [x] rdev leader AGENTS.md 含「设计控制」且不含「商务对接负责人」「CDO」
- [x] intake leader 回归仍含「商务对接负责人」
- [x] 14 份模板 lint 绿灯;真 PI 终稿五节实质论证
- [x] `go vet` + `go test -short` 全绿
## 相关链接
- Test report: [.doc/test-reports/2026-09-17-rdev-template-depth-test-report.md](../../test-reports/2026-09-17-rdev-template-depth-test-report.md)
- Assets: [.doc/test-reports/assets/2026-09-17-rdev-template-depth/](../../test-reports/assets/2026-09-17-rdev-template-depth/)
- Backlog: [.doc/backlog/2026-09-17-rdev-phase2-backlog.md](../../backlog/2026-09-17-rdev-phase2-backlog.md)
- 写作规范: [.doc/system-design/project-workflow/08-rdev模板写作规范.md](../../system-design/project-workflow/08-rdev模板写作规范.md)
## 证据 / 备注
- 依赖 `feature/rdev-core`(尚未合 dev);合入前需 rebase 丢弃已进 dev 的 engineering-dashboard 重复提交。
- 真 PI:`run_1789635054471569201`(intake ~220s);`run_1789635960880707641`(DI ~450s,`stage=RD03_design_input`)。

Some files were not shown because too many files have changed in this diff Show More