Skip to content

feat: separate Task, Read, and Effect audit stages - #9

Merged
Gandy2025 merged 2 commits into
mainfrom
feat/three-stage-evidence-model
Jul 31, 2026
Merged

feat: separate Task, Read, and Effect audit stages#9
Gandy2025 merged 2 commits into
mainfrom
feat/three-stage-evidence-model

Conversation

@Gandy2025

Copy link
Copy Markdown
Contributor

Summary

  • reconstruct Tasks from a message-only artifact and freeze the normalized inventory before any Read or Effect analysis
  • move Read attribution and Effect judgment into separate digest-bound schema-v4 artifacts
  • allow each Task to carry zero or more independently validated Effects
  • keep collection, authorization, trace adapters, and conservative Read recovery unchanged
  • publish the Skill as version 0.5.0

Why

The combined schema-v3 judgment could let audit evidence shape Task identity and limited a continuous Task to one Effect. Task boundaries should instead be reconstructed from work dialogue and attribution evidence alone. Once frozen, Reads can be attributed without resizing the Task, and each later Read → choice → outcome relationship can be judged independently.

The user-facing model remains Task, Read, and Effect. The inventory digest is an internal integrity fence, not a new evidence concept or authenticity claim.

Behavior

The workflow now has three ordered stages:

  1. task-source projects authorized work messages without collector-derived Reads, passages, receipts, choice projections, or Effect judgments.
  2. freeze-tasks validates pure Task rows, rejects unknown or derived fields, and writes one shared inventory digest.
  3. report validates digest-bound Read attributions and zero-or-more Effect judgments.

Additional fail-closed rules cover:

  • malformed derived evidence cannot block Stage 1;
  • a Read must complete after it starts and strictly before an Effect choice;
  • Task, Read, Effect, source-fragment, linkage, and task-source objects reject unknown fields;
  • one Read belongs to one Task, while the same Task Read may support multiple Effects;
  • one choice message cannot be reused across Effects;
  • schema-v4 private artifacts are ignored and rejected from repository commits.

Real-data validation

The current authorized Chat was replayed over the previous seven days:

  • 95 visible messages
  • 7 clear Tasks / 4 excluded candidates
  • 3 Read-observed Tasks / 4 unresolved
  • 0 Effect Tasks / 0 Effects
  • 192 Tree-related command attempts conserved as 0 exact, 5 read-only composite, 55 unresolved, and 132 rejected

Running schema v3 against the same 95 messages produced the same Task, Read, and Effect counts. The zero-Effect result is therefore evidence-driven rather than caused by the new Task model: direct human instructions fully explained one outcome, two Reads were archive/supporting content, and one normal-content Read occurred after the human had already supplied the decision.

The multi-Effect behavior is covered independently by deterministic fixtures with one Task, two Effects, one shared Read, distinct choices, and separate conservation counts.

Validation

  • python3 -m unittest discover -s tests -v — 51 passed
  • python3 scripts/validate_skill.py
  • python3 -m compileall -q skills tests scripts
  • git diff --check
  • final ZIP integrity, canonical seven-file layout, extracted CLI help, and full current-Chat replay
  • two independent correctness/security reviews, followed by incremental re-review with no remaining blockers

Context Tree

Read against agent-team-foundation/first-tree-context@e36f5c04b6a4af6f7a803c5303559b94877baf39. The existing contract that a decision receipt is Agent attribution and supporting evidence—not server-verified causal proof—remains unchanged.

@Gandy2025
Gandy2025 requested a review from yuezengwu as a code owner July 30, 2026 09:08

@yuezengwu yuezengwu left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

实现目标和核心改动已核对:这个 PR 将 schema-v3 的组合判断拆成 message-only Task 重建与冻结、Read attribution、Effect judgment 三个有 digest 约束的阶段,并支持一个 Task 上的多个独立 Effect。整体边界与计数模型是连贯的,但当前有一个必须修复的时序 blocker。

skills/context-tree-value-audit/scripts/context_tree_value_audit.py:6189

这里使用 read_started_at > read_completed_at,因此 timestamp == completed_at 的零时长 Read 会通过验证;只要它又严格早于 choice,就能进入 observed attribution 甚至 Effect。PR 描述和 fail-closed 规则要求 Read “complete after it starts”,应拒绝相等时间。请把边界改为拒绝 read_started_at >= read_completed_at(并同步错误文案),再补一个起止时间相等的回归用例。现有测试只覆盖了完成时间早于开始时间,以及完成时间等于 choice 的情况,没有覆盖这个边界。

@Gandy2025

Copy link
Copy Markdown
Contributor Author

Fixed in 877b3de.

  • validate_read_refs now rejects read_started_at >= read_completed_at, so a Read must complete strictly after it starts.
  • The validation error now states that strict requirement directly.
  • Added a regression case for timestamp == completed_at; the existing reversed-time case remains covered.

Validation:

  • python3 -m unittest discover -s tests -v — 51/51 passed
  • python3 scripts/validate_skill.py — passed
  • python3 -m compileall -q skills tests scripts — passed
  • git diff --check — passed

Please re-review the latest head.

@Gandy2025
Gandy2025 requested a review from yuezengwu July 31, 2026 02:20

@yuezengwu yuezengwu left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已对 head 877b3de7 完成增量复审。

原 blocker 已正确修复:Read 起止时间相等现在会被 read_started_at >= read_completed_at 拒绝,错误文案同步为严格完成顺序,并新增零时长 Read 回归用例。增量未引入新的 blocker。

核心 schema-v4 数据结构变更与前次审查一致;未看到数据库变更。GitHub 上 Python 3.11/3.12 检查均通过。

@Gandy2025
Gandy2025 merged commit b9271de into main Jul 31, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants