Skip to content

feat(sources): admit Claude Workflow artifacts through OriginSpec - #3088

Merged
Sinity merged 2 commits into
masterfrom
feature/sources/claude-workflow-admission
Jul 18, 2026
Merged

Sinity merged 2 commits into
masterfrom
feature/sources/claude-workflow-admission

Conversation

@Sinity

@Sinity Sinity commented Jul 18, 2026

Copy link
Copy Markdown
Owner

Summary

Admits all six Claude Code Workflow artifact families (coordinator session streams, run-state snapshots, mutable journals, attempt transcripts, attempt metadata sidecars, adopt manifests) through the existing OriginSpec contract, with raw-revision retention in source.db and an atomic claude-workflow:* work-evidence materialization pass.

Problem

polylogue-2qx.2 (mandate-critical): Workflow artifacts produced by Claude Code orchestration were watched but not admitted — no OriginSpec classification, no retention of journal revisions, no evidence graphs. Ref polylogue-2qx.2.

Solution

External GPT-Pro delivery mandate-01-claude-workflow-admission-r01, applied verbatim at its declared authority snapshot bf8191b3f, then rebase-integrated onto current master by the coordinator:

  • Commit 1: the delivery as authored (OriginSpec rules + watcher suffixes, parser/orchestration, claude_workflow_evidence/claude_workflow_materializer, convergence stage, synthetic wf_54d4fb2e-841 corpus integration test), topology regenerated.
  • Commit 2: integration fixes for post-snapshot master drift — typed ParseBatchObservation workflow keys (nested summary, no untyped ** expansion), IngestDiagnostics annotation, walk-tuple unpacking, Literal association_state, warning log on artifact parse fallback (degrade-loudly gate).

Verification

  • devtools test tests/unit/insights/test_claude_workflow_evidence.py tests/unit/sources/test_live_watcher.py tests/unit/sources/test_origin_specs.py tests/integration/test_claude_workflow_admission.py — 91 passed (real devshell, no shims — the delivery's own env used import shims).
  • devtools verify --quick — all steps ok (format, lint, mypy --strict, render-all check, topology, layering, degrade-loudly).

Delivery custody: .agent/handoffs/external-agent-campaigns/2026-07-17-gpt-pro-wave-2/results/mandate-01/r01/.

🤖 Generated with Claude Code

https://claude.ai/code/session_01QUsH3Rhq6oAZpYPWcsZqnZ

Sinity and others added 2 commits July 18, 2026 14:23
External GPT-Pro delivery mandate-01 (2qx.2), applied verbatim at its
declared authority snapshot bf8191b before rebase.

Ref polylogue-2qx.2

Co-Authored-By: GPT-Pro external agent <[email protected]>
Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01QUsH3Rhq6oAZpYPWcsZqnZ
Rebase-integration fixes for the mandate-01 delivery against moved
master: typed ParseBatchObservation workflow keys (nested summary instead
of untyped expansion), IngestDiagnostics annotation, tuple unpacking for
walk paths, Literal association_state, and a warning log on the artifact
parse fallback (degrade-loudly).

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01QUsH3Rhq6oAZpYPWcsZqnZ
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@coderabbitai

coderabbitai Bot commented Jul 18, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@Sinity, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 14 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: a5bcf100-9e05-434c-a13e-b40d02694531

📥 Commits

Reviewing files that changed from the base of the PR and between 3f7f655 and 4a66d80.

📒 Files selected for processing (22)
  • docs/plans/topology-target.yaml
  • docs/topology-status.md
  • polylogue/archive/artifact_taxonomy/models.py
  • polylogue/daemon/convergence_stages.py
  • polylogue/insights/claude_workflow_evidence.py
  • polylogue/insights/claude_workflow_materializer.py
  • polylogue/insights/work_evidence.py
  • polylogue/pipeline/payload_types.py
  • polylogue/pipeline/services/archive_ingest.py
  • polylogue/pipeline/services/parsing_workflow.py
  • polylogue/sources/live/batch.py
  • polylogue/sources/live/watcher.py
  • polylogue/sources/origin_specs.py
  • polylogue/sources/parsers/claude/orchestration.py
  • polylogue/storage/sqlite/queries/work_evidence.py
  • tests/integration/test_claude_workflow_admission.py
  • tests/unit/daemon/test_convergence_stages.py
  • tests/unit/insights/test_claude_workflow_evidence.py
  • tests/unit/insights/test_work_evidence.py
  • tests/unit/sources/test_artifact_taxonomy.py
  • tests/unit/sources/test_live_watcher.py
  • tests/unit/sources/test_origin_specs.py
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/sources/claude-workflow-admission

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@Sinity
Sinity merged commit 1e0246d into master Jul 18, 2026
3 checks passed
@Sinity
Sinity deleted the feature/sources/claude-workflow-admission branch July 18, 2026 12:39
Sinity added a commit that referenced this pull request Jul 18, 2026
…, misc-01 r01-loose)

mandate-01 integrated (PR #3088, 91 focused tests green after rebase
integration); ann-04 filed as needs_rebase_review (41ow judgment
transaction, patch conflicts with moved master — adjudication input for
the 41ow lane item); misc-01 loose-file second copy recorded as
superseded by merged #3079. Clipboard FINAL-SUMMARY for ann-04 captured
alongside its loose files. Wave 2 custody now covers 32/32 missions +
mandate/support portfolio.

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01QUsH3Rhq6oAZpYPWcsZqnZ
Sinity added a commit that referenced this pull request Jul 18, 2026
Custody-only: receipts + index entries for mandate-01 (integrated via PR
#3088), ann-04 (needs_rebase_review — 41ow judgment transaction),
misc-01 loose-file second copy (superseded by #3079). No code.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_01QUsH3Rhq6oAZpYPWcsZqnZ

Co-authored-by: Claude Fable 5 <[email protected]>
Sinity added a commit that referenced this pull request Jul 19, 2026
…lution deliveries (#3177)

## Summary

Re-triages two ChatGPT-Pro handoff packages staged at
`/realm/tmp/gpt-pro-intake-0719/` (`judgment-*.md/.diff`,
`config-*.md/.diff`), targeting snapshot
`536a53efac0cbe4a2473ad379e4db49ef3fce74d`
(#3046). Both are byte-identical duplicate downloads of packages already
on
file as `results/ann-04/r01` and `results/misc-01/r01`. Per the custody
policy (`results/README.md`: "Duplicated browser downloads with
identical
SHA-256 values are deliberately not copied twice", precedent:
`lin-01/r01`),
this PR does **not** mint a second package-revision identity or
duplicate
raw/extracted artifact bytes — it records the 2026-07-20 reassessment as
a
dated `reassessments` entry inside each existing `r01` receipt, with the
top-level `state` updated where the evidence changed. No patch is
applied to
master; no bead is closed or reopened.

## Problem

Both files were flagged as fresh wave-2 deliveries needing triage.
Master has
moved ~180 commits (33+ merges) past the stated snapshot.

## Solution

**Pairing verification (step 0):** `judgment-*` files cross-reference
polylogue-41ow/37t.12/mrxt and match mission
`ann-04-judgment-transaction`;
`config-*` files cross-reference polylogue-fd2s/9gh1 and match mission
`misc-01-config-closure`. The mapping was correct as staged.

**Commission identification (step 1):** both missions already have `r01`
result entries on disk. SHA-256 of every one of the 8 delivered files is
byte-identical to the corresponding `results/ann-04/r01` and
`results/misc-01/r01` artifacts (`diff -q` reports no differences) —
these
are re-submissions of packages already triaged 2026-07-18, not new
deliveries.

**Triage (step 2), recorded as `reassessments` entries in the existing
`r01`
receipts:**

- `git apply --check` passes cleanly for both patches against the stated
  snapshot (integrity confirmed) and fails for both against current
`origin/master`, re-checked three times as master advanced during triage
(`e963e87f5` → `1c0f4eccd` → `610ce8d9`, none of the intervening commits
  touch the affected core files).

- **ann-04 (judgment-transaction): `r01` state `needs_rebase_review` →
`superseded`.** bd `polylogue-41ow` (closed, PR #3101+#3110)
independently
fixed the writer-slot TOCTOU race; bd `polylogue-2o3d` (closed, PR
#3138)
independently ported the delivery's entire non-overlapping additive
scope
  (evidence previews, queue health, judge-command consolidation, capture
idempotency) after its own line-by-line audit found the MCP-surface
hunks
  obsolete (six-tool cutover) and the delivery's transaction mechanism
redundant with #3101. Supersession is now total — every
acceptance-matrix
row this delivery claims already has an independent, merged, adjudicated
  master implementation.

- **misc-01 (config-resolution-closure): `r01` state stays `superseded`,
rationale now explicit.** PR #3079 (merged 2026-07-18, explicitly
sourced
  from an earlier revision of this same GPT-Pro packet family) already
shipped `ResolvedRuntimeConfig`, the single resolver, the `archive_root`
  TOML fix, and deep-merge for nested health tables (live-checked
  `polylogue/config.py:1514` `_merge_toml`/`_deep_merge_table`).
  `needs_rebase_review` does not apply here: there is no viable rebase
  target for this patch against the current config API — #3079 shipped a
differently-shaped `ResolvedRuntimeConfig` with no common ancestor, so
any
further work must be **re-derived against the landed API, not revived**
  from this diff. The genuine residual (bd `polylogue-uu8r`'s env-bypass
  migration scope — spot-checked `polylogue/daemon/backup.py:695` and
  `polylogue/pipeline/services/archive_ingest.py:48`, both still direct
  `os.environ.get()` reads on master) is tracked durably as
  `polylogue-uu8r` directly, not as a pending state on this package.

Also noted, out of scope for this PR: `polylogue-fd2s`/`polylogue-9gh1`
still read `status=open` in `bd` despite #3079's landing — likely
bookkeeping lag, flagged in the bead notes for a separate housekeeping
pass.
A stray `clipboard-current.txt` in the intake directory is unrelated
leftover clipboard text for the already-integrated `mandate-01` delivery
(same SHA as `results/mandate-01/r01`, PR #3088, merged) — not part of
either package, not touched by this PR.

## Verification

- `sha256sum` on all 8 delivered files, cross-checked against existing
`r01`
  records: identical.
- `git apply --check` against
`536a53efac0cbe4a2473ad379e4db49ef3fce74d`:
  clean for both patches (detached worktree).
- `git apply --check` against `origin/master`, checked at `e963e87f5`,
  `1c0f4eccd`, and `610ce8d9` as master advanced during triage: fails
identically every time (20 production files for judgment, 21 for config;
  some judgment files/tests no longer exist post six-tool MCP cutover).
- `bd show polylogue-41ow/fd2s/9gh1/cxlk/uu8r/2o3d --json` to confirm
current
  close/open state and what each merged PR actually covers.
- `grep -rl ResolvedRuntimeConfig polylogue/` plus a read of
`polylogue/config.py:1514` (`_merge_toml`/`_deep_merge_table`) to
confirm
  the architecture is live on master, not just claimed by a PR title.
- `devtools verify --quick`: 16/16 green (pre-push hook, this branch,
each
  push).
- Triage notes appended to `polylogue-41ow` and `polylogue-fd2s` (plus a
  correction note on both retracting the earlier, policy-violating `r02`
  framing) via `bd update --append-notes` + `bd export`.

Ref polylogue-41ow, polylogue-fd2s, polylogue-9gh1, polylogue-2o3d

Co-authored-by: Claude <[email protected]>
Sinity added a commit that referenced this pull request Jul 21, 2026
## Summary

Closes the remaining conformance-law gaps in the OriginSpec admission
kernel
(`polylogue/sources/origin_specs.py`) against every clause of
`polylogue-2qx.1.1`'s acceptance criteria: a
public-origin/Provider-token leak
guard, a stream/parser binding parity check against dispatch, and a live
proof of the `lifecycle="reserved"` admission path.

## Problem

`polylogue-2qx.1.1` asked for the OriginSpec admission kernel (built on
the
`polylogue/declarations` DeclarationSpec kernel from `polylogue-o21.1`)
plus a
conformance law where missing parser, stream/parser conflict, ambiguous
detector order, absent fixture, undeclared coverage, leaked Provider
token,
and non-injective Provider-to-Origin collision each yield a
source-locatable
diagnostic.

Auditing the live repo found the kernel **already exists on master** —
`polylogue/sources/origin_specs.py` landed incrementally via unrelated
feature PRs (#3051, #3087, #3088, #3092, #3201, #3228: Claude Workflow
admission, Hermes ATOF/ATIF, the Grok parser, provider_completeness
migration) without ever citing this bead, so `bd`'s tracking never
reflected
it — the 2026-07-18 warroom sweep found no bead-tagged commits and reset
the
bead to open even though the code was there. It already covers all 11
`Origin` tokens, consumes the declarations kernel correctly, and is
wired
into `provider_completeness.py`, the artifact taxonomy, the live
watcher, and
Claude Code orchestration.

Auditing it clause-by-clause against the AC found three real gaps:

1. No diagnostic caught a public origin `public_name` colliding with a
raw
   `Provider`-wire token — the doctrine in
`docs/provider-origin-identity.md` ("no provider wording on public
origin
   surfaces") was enforced only indirectly (public_name must equal
   `origin.value`, and no current `Origin`/`Provider` pair happens to
collide), with no explicit guard or diagnostic for a future collision.
2. No check parity-verified declared `stream_parser_path` presence
against
`sources/dispatch.py:STREAM_RECORD_PROVIDERS` — a stream/parser binding
could silently drift from dispatch's actual streaming behavior with no
   diagnostic.
3. The module docstring still claimed a live "reserved origin" pilot,
but
Grok shipped a real parser (`polylogue-611`, #3201) after this bead was
written, so no `OriginSpec` is currently `lifecycle="reserved"` and that
   admission path had no live proof.

## Solution

- Added `_PROVIDER_TOKEN_VALUES` and a guard in
`OriginSpecRegistry.register()`
that rejects a declaration whose `public_name` collides with any
`Provider`
enum value, ordered before the existing public-name/origin equality
check
  so it is independently testable (a synthetic declaration can trip it
  without also tripping the equality check).
- Added `validate_stream_parser_parity()`, parity-checked against
  `sources/dispatch.py:STREAM_RECORD_PROVIDERS` the same way
`validate_dispatch_precedence()` already parity-checks detector
tightness
order. **Zero edits to `dispatch.py`** — only a new read-only import of
its
  existing `STREAM_RECORD_PROVIDERS` constant, respecting this slice's
ownership boundary with the concurrent `ingest_worker.py`/`decoders.py`
  lane.
- Updated the module docstring to honestly state Grok's promotion from
reserved to executable, and point at the new synthetic
reserved-lifecycle
test as the live proof of that admission path (since no real production
  `Origin` is currently reserved).
- Added five tests to `tests/unit/sources/test_origin_specs.py`:
undeclared-
  coverage rejection, provider-token-leak rejection, a synthetic
`lifecycle="reserved"` registration (built via `replace()` of the real
Grok
spec) proving the reserved admission contract requires no
parser/detector
tightness while still requiring coverage/fixture evidence, and positive
  plus negative stream/parser parity checks.

## Verification

- `devtools test tests/unit/sources/test_origin_specs.py` → 8 passed
- `devtools test tests/unit/sources/test_dispatch_ordering.py
tests/unit/sources/test_dispatch_payloads.py` → 21 passed
- `devtools test -k "provider_completeness or origin_specs or
dispatch_ordering"` → 26 passed
- `mypy --strict polylogue/sources/origin_specs.py
tests/unit/sources/test_origin_specs.py` → Success, no issues found
- `devtools verify --quick` → exit 0 (all 16 steps ok: format, lint,
mypy, render all, topology, layering, closure-matrix, schema roundtrip,
manifests, ci-workflows, doc-commands, docs-coverage,
test-infra-currency, test-clock-hygiene, pytest-timeout-overrides,
degrade-loudly)
- No new module/file added, so no topology projection regen was
required.

## AC matrix

| # | AC | Status |
| --- | --- | --- |
| 1 | `origin_specs.py` defines complete typed fields/lifecycle states,
consumes `polylogue/declarations` without adding source semantics to
that kernel | Satisfied (pre-existing on master; verified by reading
`polylogue/declarations/*` and confirming `origin_specs.py` only wraps
`DeclarationSpec`/`DeclarationRegistry`, adding no kernel-layer
semantics) |
| 2 | Claude Code / ChatGPT / reserved Grok pilots derive/validate
deterministic tightness, parser/assembly registration, public origin
values, coverage/completeness rows, fixtures, docs, reparse consequences
from one declaration each | Satisfied for Claude Code (executable,
tightness 60, stream+artifact-rule bindings) and ChatGPT (executable,
tightness 70). Grok itself is now executable (real parser shipped after
this bead was written, #3201) rather than reserved; the
reserved-lifecycle admission contract is proven live by this PR's new
synthetic test rather than by a real reserved origin, since every
current public `Origin` token is admitted as executable or
compatibility-only |
| 3 | `dispatch.py` uses derived registration/order or is parity-checked
by it; adding a synthetic executable origin requires one OriginSpec +
adapter + fixtures | Satisfied — `validate_dispatch_precedence()`
(pre-existing) plus this PR's new `validate_stream_parser_parity()`
parity-check `dispatch.py`'s
`RECORD_DETECTOR_PROVIDER_ORDER`/`STREAM_RECORD_PROVIDERS` without
restructuring dispatch.py |
| 4 | Missing parser / stream-parser conflict / ambiguous or cyclic
detector order / absent fixture / undeclared coverage / leaked Provider
token / non-injective collision each yield a source-locatable diagnostic
+ repair | Satisfied — missing parser, absent fixture, and non-injective
collision without policy were pre-existing `ValueError` raises (now also
covered by a dedicated undeclared-coverage test in this PR); ambiguous
detector order was pre-existing (`ambiguous_detector_tightness`); this
PR adds the previously-missing stream/parser-conflict diagnostic
(`stream_parser_parity_mismatch`) and leaked-Provider-token guard.
"Cyclic" detector order has no distinct failure mode beyond ambiguous
tightness, since tightness is a total order, not a graph |
| 5 | Provider stays in adapters, Origin is the public vocabulary,
Gemini/Drive-style collisions require an explicit collision policy |
Satisfied (pre-existing `collision_policy` field + registration guard,
exercised by `aistudio-drive`'s `Provider.GEMINI`/`Provider.DRIVE`
fiber) |
| 6 | Focused
declaration/dispatch/public-schema/completeness/fixture/mutation/render/quick
verification passes | Satisfied — see Verification section above |

`polylogue-2qx.1.2` (migrate every current origin onto OriginSpec,
delete
parallel inventories) is explicitly out of this slice's scope per the
bead's
own design text — it is largely already superseded in practice too (all
11
origins are already declared here and `provider_completeness.py` already
projects from `ORIGIN_SPECS`), but a formal audit of that bead's own AC
(exact-eleven-token enumeration, parallel-inventory deletion, dispatch
golden fixture) is left to whoever picks it up.

Ref polylogue-2qx.1.1

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **Bug Fixes**
  * Prevented origin names from exposing internal provider terminology.
* Added validation to ensure origin evidence is complete before
registration.
  * Improved consistency checks for origins that support streaming data.
* **New Features**
* Added support for reserved-lifecycle origins used in fixtures,
including required supporting evidence without requiring parser
configuration.
* Added diagnostics for mismatches between streaming capabilities and
origin configuration.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

Co-authored-by: Claude <[email protected]>
Sinity added a commit that referenced this pull request Jul 21, 2026
…gue-2qx.1.2) (#3250)

## Summary

Audits and closes the remaining gap in polylogue-2qx.1.2 ("migrate every
current origin onto OriginSpec"). Most of this bead's scope was already
shipped to `master` untagged across
#3051/#3087/#3088/#3092/#3201/#3228/#3246
(closing `polylogue-2qx.1.1`'s notes confirm this). This PR verifies
that
prior work end-to-end, proves the parity checks actually catch
regressions
(not just pass today), and closes one concrete residual gap: a second,
un-declared provider-to-assembly-hook dispatch that Claude Code, Codex,
and
AI Studio/Drive depend on.

## Problem

`polylogue/sources/origin_specs.py` already declares all eleven `Origin`
tokens with lifecycle/detector-tightness/parser/fixture/coverage
bindings,
and `polylogue/sources/provider_completeness.py` already derives its
rows
from `ORIGIN_SPECS` (`PACKAGE_MODE_SPECS` is a tuple comprehension over
it,
parity-proven by
`test_provider_completeness_is_a_projection_of_every_origin_spec`).
Dispatch-order and stream-parser-binding parity are also already
mechanically checked (`validate_dispatch_precedence`,
`validate_stream_parser_parity`) against the real production values in
`sources/dispatch.py` (`RECORD_DETECTOR_PROVIDER_ORDER`,
`STREAM_RECORD_PROVIDERS`).

What was genuinely missing: the bead's design explicitly calls for
"Claude
Code and Codex specs [to] expose typed
assembly/orchestration/title/action
extension hooks (consumed later by 2qx.2, j2zz, ih67) — a typed field on
the spec, not another registry."
`polylogue.sources.assembly.get_assembly_spec()`
is exactly that second, un-declared provider dispatch
(`ProviderAssemblySpec` factory for
`Provider.CLAUDE_CODE`/`Provider.CODEX`/
`Provider.GEMINI`) — it existed in production but had no OriginSpec
declaration or parity check, so a caller had no way to discover the hook
from `origin_specs.py` and no test would catch it drifting from the real
registry.

Also: `docs/provider-origin-identity.md` documented
Provider/Origin/Source
doctrine but never pointed at `origin_specs.py` as the per-origin
admission
authority a reader should trust over any hand-maintained list.

## Solution

- `polylogue/sources/origin_specs.py`: added
`OriginSpec.assembly_spec_path`
  (`"module/path.py:ClassName"` or `None`) declaring which
`ProviderAssemblySpec` a given origin's provider wire binds. Populated
for
  the three origins with a real live hook: `claude-code-session` →
  `assembly_claude_code.py:ClaudeCodeAssemblySpec`, `codex-session` →
  `assembly_codex.py:CodexAssemblySpec`, `aistudio-drive` →
`assembly_gemini.py:GeminiAssemblySpec` (its `Provider.GEMINI` wire is
the
one `get_assembly_spec` keys on). Added
`validate_assembly_spec_parity()`,
  following the exact idiom of `validate_dispatch_precedence`/
`validate_stream_parser_parity`: it checks the declared field against
the
live `get_assembly_spec(provider)` return value rather than replacing
that
  registry with a second one in `origin_specs.py`.
- `tests/unit/sources/test_origin_specs.py`: two new tests — one
asserting
the three declared hook paths (and `None` for two origins without a live
hook), one asserting `validate_assembly_spec_parity(get_assembly_spec)
== ()`
plus the mutation shape (a resolver that always returns `None` makes
every
origin that declares a hook path report
`assembly_spec_parity_mismatch`).
- `docs/provider-origin-identity.md`: added an "Origin admission"
section
  naming `origin_specs.py` as the per-origin declaration authority and
  pointing at both live-production parity checks.
- No parallel hand-maintained inventory was deleted, because the audit
found
none left inside my ownership (`polylogue/sources/**`) — see the
residual
  below for the one still outstanding elsewhere.

### Residual found outside owned scope

`polylogue/cli/shell_completion_values.py:_ORIGIN_DESCRIPTIONS` is a
hand-maintained `dict[str, str]` of 8 of the 11 origin tokens (missing
`beads-issue`, `grok-export`, `unknown-export`) used for
shell-completion
help text, and it is **not** parity-checked against
`Origin`/`ORIGIN_SPECS`
the way `polylogue/agent_integration/spec.py:ORIGIN_MEANINGS` already is
(that one has a `RuntimeError` guard requiring exact `Origin`-enum order
match — already satisfies AC4, no action needed there). `cli/**` is out
of
this lane's ownership (per dispatch instructions, another lane owns it
concurrently); flagging as a follow-up rather than touching it here.

## Verification

- `devtools test tests/unit/sources/test_origin_specs.py
tests/unit/sources/test_provider_completeness.py` → **15 passed**
- `devtools test tests/unit/sources/ -k "origin_specs or
provider_completeness or dispatch or assembly"` → **144 passed**
- `devtools test tests/unit/sources/test_parsers_props.py` (protected
file) → **43 passed**
- `devtools verify --quick` → all 16 steps `ok`, `"exit_code": 0` (ruff
format/check, mypy --strict, render all,
topology/layering/closure-matrix, manifests, ci-workflows, doc-commands,
docs-coverage, test-infra-currency, test-clock-hygiene,
pytest-timeout-overrides, degrade-loudly)
- Anti-vacuity mutations, run manually then reverted (`git checkout
--`), each confirmed the *existing* production dependency actually fails
on the mutation before I added anything:
- Removing `_grok_spec()` from the registration loop →
`ORIGIN_SPEC_REGISTRY.diagnostics()` reports `missing_origin_spec` for
`grok-export`.
- Dropping Claude Code's `detector_tightness` below
`gemini_cli_session`'s (contradicting its real last-in-branch-order
position) →
`validate_dispatch_precedence(RECORD_DETECTOR_PROVIDER_ORDER)` reports
`dispatch_tightness_mismatch`.
- Deleting Codex's new `assembly_spec_path` declaration →
`validate_assembly_spec_parity(get_assembly_spec)` reports
`assembly_spec_parity_mismatch` for `codex-session` (this is the
mutation the new code in this PR is proven against).

## AC matrix (polylogue-2qx.1.2)

1. **Satisfied (pre-existing).** All eleven `Origin` tokens are declared
exactly once in `ORIGIN_SPECS`; `set(by_origin) == set(Origin)` is
asserted in
`test_origin_specs_cover_the_public_enum_and_admission_lifecycles`, and
`OriginSpecRegistry.diagnostics()` emits `missing_origin_spec` for any
omission (proven above).
2. **Satisfied (pre-existing + this PR).** Every executable origin
declares acquisition modes,
detector/parser/stream-parser/fixture/coverage/fidelity/reparse fields;
`claude-code-session` additionally declares 6 typed
`OriginArtifactRule`s for its
workflow/journal/transcript/sidecar/adopt-manifest/coordinator-stream
family. `grok-export` is `lifecycle="executable"` today (it shipped a
real parser via #3201/polylogue-611 after 2qx.1.1's pilot design assumed
it would stay reserved — documented at the top of `origin_specs.py`);
the `reserved` lifecycle contract itself is proven against a synthetic
variant since no current `Origin` is genuinely reserved.
`unknown-export` is `lifecycle="compatibility-only"` with explicit
fallback semantics; `beads-issue` is executable with `issue-jsonl`
acquisition and its own non-`accepted` completeness maturity caveat (no
harvested schema sample yet). This PR adds the Claude/Codex/AI-Studio
assembly hook declaration.
3. **Satisfied (pre-existing).**
`validate_dispatch_precedence`/`validate_stream_parser_parity`
parity-check tightness and stream-binding against
`sources/dispatch.py`'s real
`RECORD_DETECTOR_PROVIDER_ORDER`/`STREAM_RECORD_PROVIDERS`;
mutation-proven above (deleting/reordering a declaration fails).
4. **Satisfied (pre-existing) for `provider_completeness.py`; this PR
extends it to the assembly-hook axis.** `PACKAGE_MODE_SPECS` is a direct
tuple comprehension over `ORIGIN_SPECS`, parity-proven by
`test_provider_completeness_is_a_projection_of_every_origin_spec`.
`agent_integration/spec.py:ORIGIN_MEANINGS` is separately parity-guarded
against `Origin` at import time. **Deferred**:
`cli/shell_completion_values.py:_ORIGIN_DESCRIPTIONS` remains a stale,
un-parity-checked hand-maintained inventory — out of this lane's
ownership (`cli/**`), flagged as a residual above rather than a named
follow-up bead (small, mechanical, single-file fix for whichever lane
next touches CLI completions).
5. **Satisfied (pre-existing).** `aistudio-drive`'s
`provider_wires=(Provider.GEMINI, Provider.DRIVE)` with
`collision_policy` is registration-enforced
(`OriginSpecRegistry.register` raises `ValueError` if
`len(provider_wires) > 1` without a `collision_policy`, tested in
`test_origin_spec_rejects_missing_fixture_and_noninjective_collision_without_policy`);
`docs/provider-origin-identity.md` already documented the non-reversal
doctrine, and this PR adds the pointer from that doc to the enforcing
code.
6. **Misframed — recorded honestly rather than claimed satisfied.**
`polylogue-2qx.2` (Claude Code orchestration artifact admission) already
closed via PR #3088, and its own close reason states it shipped as a
`claude_workflow_materializer` convergence stage *without* the
OriginSpec migration this bead was meant to gate — the blocking edge was
explicitly force-closed as "over-blocking" because the merged
implementation disproves that ordering. So AC6 as written ("Claude/Codex
extension hooks are the only admission path used by 2qx.2...") cannot be
retroactively true for `2qx.2`. `j2zz` (Codex child-action lowering) and
`ih67` (Codex title enrichment) are still open; this PR's new
`assembly_spec_path`/`validate_assembly_spec_parity` gives them a real
typed admission point to consume going forward, but I did not modify
`assembly_codex.py`/`ih67`/`j2zz` scope — those remain their own beads'
work, not migrated by me here.

## Files touched

- `polylogue/sources/origin_specs.py`
- `tests/unit/sources/test_origin_specs.py`
- `docs/provider-origin-identity.md`

Ref polylogue-2qx.1.2

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **Documentation**
- Added guidance on how origin metadata is declared, validated, and kept
aligned with runtime behavior.
- Documented checks for provider completeness and assembly-related
configuration.

- **Improvements**
- Added validation to detect mismatches between declared origin
capabilities and available assembly behavior.
- Added assembly configuration metadata for Claude Code, Codex, and AI
Studio origins.

- **Tests**
- Added coverage confirming assembly declarations and runtime parity
checks behave as expected.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Claude <[email protected]>
Sinity added a commit that referenced this pull request Jul 31, 2026
…is artifacts (#3426)

## Summary

Investigated the reported contradiction that Claude Code Workflow
artifacts
appear both correctly normalized (closed beads
polylogue-z9gh.4/z9gh.6/2qx.2)
and independently ingested as zero-message sessions. Fixes the one part
of
that contradiction that is a live code defect (a self-generated analysis
artifact misclassified as a session), and files/corrects Beads for the
parts
that are not: a stale-data reparse gap and one inaccurately-closed bead.

## Problem

`polylogue-omsw` (open) documents zero-message Claude Code sessions
whose
source is a non-conversational artifact. Investigating it against the
three
closed beads that claim Workflow normalization/admission is done
surfaced
three distinct findings, verified directly against the live archive
(read-only `index.db`/`source.db` queries) rather than assumed from bead
text:

1. **Live code defect (fixed here):** a self-generated analysis index an
   agent had written into its own Claude Code project directory
(`analysis/problem_solutions/problems_index.jsonl`, JSONL records shaped
   like `{"conversation": <id>, "type": "unknown", "preview": ...}`) was
   ingested as a `claude-code-session` with zero messages. The recursive
   source walk already skips any directory literally named `analysis`
   (`source_walk._SKIP_DIRS`), but that skip only guards the treewalk
discovery route — `classify_artifact_path` had no equivalent path-only
   exclusion, so the file fell through to payload-shape heuristics.
`looks_like_record_entry` misread each record as session content purely
   because `type` is a generic recordish key — the exact "unrecognised
   record defaults to a session" failure mode `polylogue-9ykn` (P0)
   describes generally.

2. **Not a live defect — stale data:** the 172 zero-message sessions
under
   the `workflows/`/`subagents/workflows/` artifact family (164
`agent_sidecar_meta` + 7 `workflow_run_snapshot` + 1 other) are **not**
   caused by a current classification bug. Directly testing
`classify_artifact_path` against the live paths today confirms current
   code already returns `parse_as_session=False` for all four Workflow
   artifact kinds, via the OriginSpec rules PR #3088 (`1e0246d77`,
2026-07-18) added. The 172 rows were all acquired 2026-07-14..26, before
the deployed daemon build advanced past that fix (sinnix's `polylogue`
   flake input only reached a revision containing it on 2026-07-29). The
   real remaining gap: `1e0246d77` changed session/fact classification
   semantics without declaring an `INDEX_SCHEMA_VERSION`
`SEMANTIC_REPARSE` bump, so the daemon's convergence loop has no signal
to reparse already-materialized wrong rows. Filed **polylogue-lzh8** to
declare that bump (not executed here — a reparse is a consequential live
action needing explicit operator scheduling, out of this PR's scope per
   the task boundary).

3. **Inaccurate bead closure:** `polylogue-z9gh.6` ("Audit ingestion
   coverage for Claude Code Workflow sidecars") claims "readiness and
   repair commands no longer report healthy solely because
   `subagents/workflows` is classified as a known sidecar." False as
   written: `assembly_claude_code.py`'s `orchestration_coverage`/
   `orchestration_parse_gaps` struct is computed every ingest pass and
   consumed by nothing except its own unit test — dead code. A second,
   separate coverage computation (`claude_workflow_materializer.py`'s
`gaps`) does run live and is logged during daemon convergence, but only
   as a log line, not a queryable readiness/repair surface. Added a
   corrective note to `z9gh.6` and filed **polylogue-uh9l** for the
   remaining scope.

`polylogue-2qx.2` and `polylogue-z9gh.4` are **accurately** closed —
verified directly: `work_evidence_nodes`/`work_evidence_edges` contain 7
Workflow runs, 122 calls, 164 attempts, 128 structured results, and the
`wf_54d4fb2e-841` fixture reproduces its exact declared counts (91
attempts,
50 calls, 65 results). Not stale beads.

## Solution

`polylogue/archive/artifact_taxonomy/runtime.py`:
`classify_artifact_path`
now refuses any path containing an `analysis/` directory segment as a
non-session `METADATA_DOCUMENT`, mirroring `source_walk._SKIP_DIRS`'s
intent
at the taxonomy layer so the exclusion holds for every acquisition route
(not only the recursive walk that already skips it). Added a regression
test using the observed payload/path shape
(`test_self_generated_analysis_index_is_not_a_session`).

Beads: filed `polylogue-lzh8` (declare the missing `SEMANTIC_REPARSE`
index bump, quantifying live impact) and `polylogue-uh9l` (wire Workflow
coverage into an actual readiness surface, remove the dead struct);
corrected `polylogue-z9gh.6`'s notes; updated `polylogue-omsw` with the
narrowed evidence distinguishing its still-live
`tool-results/toolu_*.json`
gap from the now-explained/reparse-only workflow-journal slice.

No repair executed against the live archive; no rows deleted or
modified.

## Verification

```
devtools test tests/unit/sources/test_artifact_taxonomy.py tests/unit/sources/test_assembly_claude_code_history.py
# 19 passed

devtools verify --quick
# exit 0 (format, lint, mypy --strict, render all --check, topology, layering,
#         schema-versioning policy, degrade-loudly, hash-boundary-census, etc.)
```

`devtools verify` (testmon-affected) was not run — this worktree's
testmon
cache was unseeded (fresh checkout); `--quick` plus the two focused test
files above cover the actual diff.

Ref polylogue-omsw, polylogue-9ykn, polylogue-lzh8, polylogue-uh9l.
Sinity added a commit that referenced this pull request Jul 31, 2026
…low-artifact reparse (#3433)

## Summary

Two related aggz-invariant-2 follow-ups ("exactly one chokepoint may
write a
session"):

1. **polylogue-xwkh** — closes the third of three chokepoints that
decide
   whether a raw record becomes a session. PR #3428 unified live daemon
   ingest and rebuild replay behind `classify_artifact`/
   `artifact_rule_for_path`; live incremental append
   (`sources/live/append_ingest.py`) had no such gate at all.
2. **polylogue-lzh8** — declares the missing `SEMANTIC_REPARSE`
index-version
   bump for PR #3088 (1e0246d), which shipped a classification fix for
   Claude Workflow artifacts with no version declaration, so already-
   materialized wrong rows never got a reparse signal.

Also investigates (per polylogue-xwkh/lzh8's own framing) why
`devtools lab policy schema-versioning` didn't stop #3088's undeclared
bump,
and files a follow-up bead rather than rushing a fix.

## Problem

**xwkh**: `_ingest_append_plans_archive` called `parse_payload` on every
append unconditionally. Empirically verified (fresh in-memory archive,
`ingest_append_plans` called directly) that a growing
OriginSpec-declared
"fact" artifact (`subagents/workflows/<run>/journal.jsonl`,
`parse_policy="fact"`) reaching append tracking — e.g. after an ops.db
cursor reset resynthesizes a cursor from a durable `full` baseline
already
recorded in source.db (`batch.py`'s `_resynthesize_cursor_from_source`,
which consults only byte-provenance, never classification) — did **not**
leak a phantom session, but only by accident:
`parse_retained_raw_sessions`
(used later, for replay) already applies the same gate and returns zero
sessions, tripping the `did not replay to exactly one session`
`RuntimeError`. That still meant a wasted raw write, a wasted parse, and
a
crash-shaped failure log on **every single observation of the file,
forever**, since a failed append never advances its cursor.

**lzh8**: measured live impact on `index.db` (read-only query,
`/realm/db/polylogue/index.db`, 2026-07-31): 5,193 zero-message
`claude-code-session` rows total, of which 172 join to a `workflows/`
artifact family under the pre-fix classification (164
`agent_sidecar_meta`,
7 `workflow_run_snapshot`, 1 other), all acquired 2026-07-14..07-26 —
entirely before the deployed daemon build contained 1e0246d (sinnix's
polylogue pin only advanced past it 2026-07-29).

**Lint gap**: `devtools/verify_schema_upgrade_lane.py`'s
`index_delta_declaration_report(INDEX_SCHEMA_VERSION)` only checks that
the
declaration table is internally complete/consistent up to the *current*
`INDEX_SCHEMA_VERSION` constant. It never inspects `origin_specs.py`,
`artifact_taxonomy/`, or any other classification source — a commit that
changes classification semantics without touching the version constant
is
invisible to it by construction. It can only catch an **undeclared
bump**,
never a **missing bump**. A real fix (content-fingerprinting the
classification tables, versioned and diffed at lint time) is a genuine
architecture addition, not a small local patch, so filed as follow-up
polylogue-qs4b instead of rushed here.

## Solution

- `polylogue/sources/live/append_ingest.py`: import
`revision_backfill._is_declared_non_session_artifact` (the same check
the
  other two chokepoints already consult) and apply it to the append's
  decoded record sample (`sample=payloads[:64]`, same bound as the live
daemon path) before calling `parse_payload`. A refused record now fails
  cleanly (`mark_raw_parse_failed` + `failed.append`) instead of via an
  uncaught-looking `RuntimeError`, with no wasted parse work.
- `polylogue/storage/sqlite/archive_tiers/index.py`: bump
`INDEX_SCHEMA_VERSION` to 48, with a header comment citing
1e0246d/#3088
  and the measured counts.
- `polylogue/storage/sqlite/lifecycle.py`: add the matching
  `IndexDeltaDeclaration(version=48, classes=(SEMANTIC_REPARSE,))` — no
  fast-forward operations, same "values depend on parser semantics, no
clone-safe SQL delta" shape as v42/v44/v45/v46. **This commit does not
run
  any rebuild.**
- `.beads/issues.jsonl`: close polylogue-xwkh, polylogue-lzh8; file
  polylogue-qs4b for the lint-gap follow-up.

### Operator action required

This PR declares the delta; it does **not** apply it. To reclassify the
172
contaminated rows, the operator must deliberately run:

```
polylogue ops reset --index && polylogued run
```

against the live archive. This was intentionally **not** run from this
branch/session per polylogue-lzh8's explicit instruction (consequential
live-daemon action, extended downtime rebuilding ~20K sessions, needs
deliberate scheduling).

## AC disposition

**polylogue-xwkh** (no formal AC list, task framed as
investigate+verify+fix+test):
- Verified empirically what append_ingest.py currently admits —
satisfied (see Problem).
- Routed through the same classify_artifact gate the other two
chokepoints use — satisfied.
- Regression test proving a record refused by the other paths is now
also refused here — satisfied
(`test_live_append_refuses_declared_non_session_artifact`).

**polylogue-lzh8**:
1. `lifecycle.py` gets a new `IndexDeltaDeclaration` bumping
`INDEX_SCHEMA_VERSION` with `classes=(SEMANTIC_REPARSE,)`, comment
naming 1e0246d/#3088 and the measured counts — satisfied.
2. PR body explicitly tells the operator a rebuild is now required —
satisfied (see above).
3. After the rebuild, the 172+ contaminated sessions reclassify —
**deferred**: not executed per the bead's own DO-NOT-EXECUTE
instruction; operator must run it deliberately.
4. `devtools lab policy schema-versioning` stays green — satisfied.
5. (informal ask) Investigate why the lint didn't catch #3088's original
miss — satisfied, see Problem/Solution; **misframed as an inline fix**:
filed polylogue-qs4b instead, since a real fix needs design work, not a
rushed patch riding this PR.

## Verification

- `devtools test tests/unit/storage/test_raw_revision_authority.py -k
test_live_append` → 3 passed.
- `devtools lab policy schema-versioning` → "Schema evolution policy
intact."
- `devtools test tests/unit/storage/test_index_fast_forward_lifecycle.py
tests/unit/storage/test_index_fast_forward_executor.py
tests/unit/devtools/test_archive_schema_fast_forward.py
tests/unit/storage/test_schema_policy_contracts.py` → 53 passed.
- `devtools verify --quick` → exit 0 (format, lint, mypy --strict,
render all --check, schema-versioning lint, schema promotion audit) —
ran twice (pre-commit local + pre-push hook).
- Not run: `devtools verify --all` (full non-integration suite) — left
for CI's post-merge heavy `test` job per this repo's per-PR test-skip
convention; not run against the live archive (read-only queries only, no
writes, no daemon run).

Ref polylogue-xwkh, polylogue-lzh8, polylogue-qs4b

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude <[email protected]>
Sinity added a commit that referenced this pull request Aug 2, 2026
…tifact rules

Problem: devtools lab policy classifier-fingerprints (PR #3532) fingerprints
looks_like*/classify_artifact* function bodies, but polylogue-qs4b's original
concrete case -- PR #3088 changing parse_as_session for four Claude Workflow
artifact kinds -- edited a declarative data table, origin_specs.py's
OriginSpec.artifact_rules, not a function. Reproduced live: mutating an
OriginArtifactRule's parse_policy with no INDEX_SCHEMA_VERSION bump passed
both devtools lab policy schema-versioning and the pre-existing
classifier-fingerprints gate.

Solution: fingerprint every OriginArtifactRule reachable from ORIGIN_SPECS
(hash of path_pattern/parse_policy/parser_path/coverage_role/path_suffixes;
fidelity_note excluded as prose, mirroring docstring exclusion for function
fingerprints), tracked in the same manifest and covered_by contract as the
existing function fingerprints. Bootstrapped the 7 live Claude Code artifact
rules as acknowledged_safe baseline entries.

Verification:
- Reproduced the #3088 failure shape live: mutated agent_transcript's
  parse_policy (session -> fact) with no version bump -> classifier-
  fingerprints failed (exit 1, named the rule as undeclared drift) while
  schema-versioning stayed green -- confirmed the gap, then confirmed the
  fix closes it, then reverted the mutation.
- devtools test tests/unit/devtools/test_verify_classifier_fingerprints.py:
  16 passed (12 pre-existing + 4 new, including a historical regression test
  replaying the #3088 parse_policy mutation and a fingerprint-stability test
  proving fidelity_note edits alone don't fire).
- devtools verify --quick: exit_code 0 (ruff format/check, mypy, render all,
  layering, closure-matrix, both lab policy gates, schema promotion audit).

Ref polylogue-qs4b

Co-Authored-By: Claude <[email protected]>
Sinity added a commit that referenced this pull request Aug 2, 2026
…tifact rules

Problem: devtools lab policy classifier-fingerprints (PR #3532) fingerprints
looks_like*/classify_artifact* function bodies, but polylogue-qs4b's original
concrete case -- PR #3088 changing parse_as_session for four Claude Workflow
artifact kinds -- edited a declarative data table, origin_specs.py's
OriginSpec.artifact_rules, not a function. Reproduced live: mutating an
OriginArtifactRule's parse_policy with no INDEX_SCHEMA_VERSION bump passed
both devtools lab policy schema-versioning and the pre-existing
classifier-fingerprints gate.

Solution: fingerprint every OriginArtifactRule reachable from ORIGIN_SPECS
(hash of path_pattern/parse_policy/parser_path/coverage_role/path_suffixes;
fidelity_note excluded as prose, mirroring docstring exclusion for function
fingerprints), tracked in the same manifest and covered_by contract as the
existing function fingerprints. Bootstrapped the 7 live Claude Code artifact
rules as acknowledged_safe baseline entries.

Verification:
- Reproduced the #3088 failure shape live: mutated agent_transcript's
  parse_policy (session -> fact) with no version bump -> classifier-
  fingerprints failed (exit 1, named the rule as undeclared drift) while
  schema-versioning stayed green -- confirmed the gap, then confirmed the
  fix closes it, then reverted the mutation.
- devtools test tests/unit/devtools/test_verify_classifier_fingerprints.py:
  16 passed (12 pre-existing + 4 new, including a historical regression test
  replaying the #3088 parse_policy mutation and a fingerprint-stability test
  proving fidelity_note edits alone don't fire).
- devtools verify --quick: exit_code 0 (ruff format/check, mypy, render all,
  layering, closure-matrix, both lab policy gates, schema promotion audit).

Ref polylogue-qs4b

Co-Authored-By: Claude <[email protected]>
Sinity added a commit that referenced this pull request Aug 2, 2026
…tifact rules (#3563)

## Summary

Extends `devtools lab policy classifier-fingerprints` (PR #3532) to also fingerprint `origin_specs.py`'s `OriginSpec.artifact_rules` declarative table, closing the specific gap named in polylogue-qs4b that the function-only gate did not cover.

## Problem

polylogue-qs4b's investigation asked whether the schema-versioning lint (`devtools/verify_schema_upgrade_lane.py`) could be made to catch an undeclared classification-semantic change, citing PR #3088 as the concrete case: it changed `parse_as_session` for four Claude Workflow artifact kinds by editing `origin_specs.py`'s `artifact_rules` table (a `parse_policy` field per `OriginArtifactRule`), with no `INDEX_SCHEMA_VERSION` bump at all.

By the time this session started, the sibling bead polylogue-gucv (a narrower but related finding about the same lint's blindness to `looks_like*`/`classify_artifact*` function drift, concrete case PR #3428) had already merged a fix: PR #3532 added `devtools lab policy classifier-fingerprints`, an AST-fingerprint gate over classification functions.

Reproduced live in this session: mutating an `OriginArtifactRule.parse_policy` (`session` -> `fact`) with no version bump passed **both** `devtools lab policy schema-versioning` and the pre-PR-#3532 `classifier-fingerprints` gate, because `OriginArtifactRule` entries are data, not `looks_like*`/`classify_artifact*` function bodies, so they were never in scope for the existing AST scan.

## Solution

`devtools/verify_classifier_fingerprints.py`:

- `collect_origin_artifact_rules()`: walks `ORIGIN_SPECS`, fingerprinting each `OriginArtifactRule` as a SHA-256 hash of its classification-relevant fields (`path_pattern`, `parse_policy`, `parser_path`, `coverage_role`, `path_suffixes` as canonical JSON). `fidelity_note` is excluded as prose documentation, mirroring how a function's leading docstring is stripped before hashing.
- `collect_all_classification_surfaces()`: merges function fingerprints and artifact-rule fingerprints into one dict, now the default `current` for `compute_drift_report` and the lookup used by `--ack`.
- Bootstrapped the 7 live Claude Code artifact rules into `docs/plans/classifier-fingerprints.json` as `acknowledged_safe` baseline entries (same mechanism PR #3532 used for the initial 36 functions).
- Updated the module docstring, `_format_report` wording ("classification functions" -> "classification surfaces" where it now covers both kinds), and `docs/internals.md`'s Schema regimes section to describe both fingerprinted surfaces and name PR #3088 as the case this half of the gate exists for.

## Verification

- Reproduced the exact failure mode before the fix: mutated `agent_transcript`'s `parse_policy` from `session` to `fact` (the same class of edit as PR #3088) with no `INDEX_SCHEMA_VERSION` bump. Confirmed `devtools lab policy schema-versioning` stayed green and the pre-fix `classifier-fingerprints` gate also stayed green (didn't see the rule at all). Reverted, applied the fix, repeated the mutation: `devtools lab policy classifier-fingerprints` now fails with `exit 1`, naming `polylogue/sources/origin_specs.py:artifact_rule:claude-code-session:agent_transcript` as undeclared drift, while `schema-versioning` alone still stays green (expected -- it is not this lint's job). Reverted the mutation again; both gates green on the clean tree.
- `devtools test tests/unit/devtools/test_verify_classifier_fingerprints.py`: 16 passed (12 pre-existing + 4 new -- artifact-rule discovery, fingerprint-changes-on-`parse_policy`-drift, fingerprint-stable-on-`fidelity_note`-edit, and a historical regression test replaying the #3088 mutation shape and asserting the gate flags it as drift).
- `devtools verify --quick`: `exit_code: 0` (ruff format/check, mypy --strict, `render all --check`, topology, layering, closure-matrix, both `lab policy` gates, schema promotion audit).

Not run: the heavy `devtools test tests/unit` full suite (per-PR CI convention skips it; this change touches only `devtools/` + `docs/` + one test file, no `polylogue/` runtime module).

Ref polylogue-qs4b
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.

1 participant