Skip to content

Commit a375021

Browse files
Merge pull request #275 from ContextLab/020-deterministic-claim-caching
spec 020: deterministic claim caching + planning reference-only verification
2 parents 089c827 + 8a4b630 commit a375021

75 files changed

Lines changed: 3338 additions & 142 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.claude/skills/speckit-clarify/SKILL.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@ $ARGUMENTS
1919

2020
You **MUST** consider the user input before proceeding (if not empty).
2121

22+
> **Scope note**: Planning artifacts state the research question, method, and
23+
> references, and defer specific empirical values (counts, dataset sizes, measured
24+
> quantities) to the implementation/research phase. Do not introduce or verify
25+
> low-level empirical numbers while clarifying — clarify what will be measured and
26+
> against which reference, not the number itself.
27+
2228
## Pre-Execution Checks
2329

2430
**Check for extension hooks (before clarification)**:

.claude/skills/speckit-plan/SKILL.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@ $ARGUMENTS
1919

2020
You **MUST** consider the user input before proceeding (if not empty).
2121

22+
> **Scope note**: Planning artifacts state the research question, method, and
23+
> references, and defer specific empirical values (counts, dataset sizes, measured
24+
> quantities) to the implementation/research phase. Do not introduce or verify
25+
> low-level empirical numbers in the plan — cite the source/reference for any
26+
> quantity rather than asserting a measured value.
27+
2228
## Pre-Execution Checks
2329

2430
**Check for extension hooks (before planning)**:

.claude/skills/speckit-specify/SKILL.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,9 +308,15 @@ When creating this spec from a user prompt:
308308
309309
### Success Criteria Guidelines
310310
311+
A planning doc states the **research question**, **method**, and **references**,
312+
and defers specific empirical values (counts, dataset sizes, measured quantities,
313+
percentages) to the implementation/research phase. Express each success criterion
314+
as *what* is measured and the *reference/source* it is measured against, rather
315+
than a pre-asserted number.
316+
311317
Success criteria must be:
312318
313-
1. **Measurable**: Include specific metrics (time, percentage, count, rate)
319+
1. **Measurable**: Name the metric (time, rate, count, percentage) and the reference/source it is measured against; do not pre-assert the empirical value here
314320
2. **Technology-agnostic**: No mention of frameworks, languages, databases, or tools
315321
3. **User-focused**: Describe outcomes from user/business perspective, not system internals
316322
4. **Verifiable**: Can be tested/validated without knowing implementation details

.claude/skills/speckit-tasks/SKILL.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@ $ARGUMENTS
1919

2020
You **MUST** consider the user input before proceeding (if not empty).
2121

22+
> **Scope note**: Planning artifacts state the research question, method, and
23+
> references, and defer specific empirical values (counts, dataset sizes, measured
24+
> quantities) to the implementation/research phase. Tasks should describe what to
25+
> measure and against which reference; do not introduce or verify low-level
26+
> empirical numbers in the task list.
27+
2228
## Pre-Execution Checks
2329

2430
**Check for extension hooks (before tasks generation)**:

.specify/feature.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"feature_directory": "specs/019-semantic-substantiation"
2+
"feature_directory": "specs/020-deterministic-claim-caching"
33
}

.specify/templates/plan-template.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@
2727
**Constraints**: [domain-specific, e.g., <200ms p95, <100MB memory, offline-capable or NEEDS CLARIFICATION]
2828
**Scale/Scope**: [domain-specific, e.g., 10k users, 1M LOC, 50 screens or NEEDS CLARIFICATION]
2929

30+
> Domain-specific empirical specifics (exact counts, dataset sizes, measured
31+
> quantities) are deferred to the research/implementation phase. For any
32+
> quantity stated here, cite its source/reference rather than asserting a
33+
> measured value.
34+
3035
## Constitution Check
3136

3237
*GATE: Must pass before Phase 0 research. Re-check after Phase 1 design.*

.specify/templates/spec-template.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,10 +109,14 @@
109109

110110
### Measurable Outcomes
111111

112-
- **SC-001**: [Measurable metric, e.g., "Users can complete account creation in under 2 minutes"]
113-
- **SC-002**: [Measurable metric, e.g., "System handles 1000 concurrent users without degradation"]
114-
- **SC-003**: [User satisfaction metric, e.g., "90% of users successfully complete primary task on first attempt"]
115-
- **SC-004**: [Business metric, e.g., "Reduce support tickets related to [X] by 50%"]
112+
> Planning docs state *what* will be measured and the *source/reference* it is
113+
> measured against; defer specific empirical values (counts, dataset sizes,
114+
> measured quantities, percentages) to the implementation/research phase.
115+
116+
- **SC-001**: [What is measured + reference, e.g., "Task-completion time is measured against the current manual baseline"]
117+
- **SC-002**: [What is measured + reference, e.g., "Throughput under load is measured against the documented capacity requirement"]
118+
- **SC-003**: [What is measured + reference, e.g., "Primary-task success rate is measured against the prior workflow's observed rate"]
119+
- **SC-004**: [What is measured + reference, e.g., "Support-ticket volume for [X] is measured against the pre-change trailing average"]
116120

117121
## Assumptions
118122

CLAUDE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,5 +70,5 @@ Since this is primarily a research documentation repository without traditional
7070
<!-- SPECKIT START -->
7171
For additional context about technologies to be used, project structure,
7272
shell commands, and other important information, read the current plan:
73-
[specs/019-semantic-substantiation/plan.md](specs/019-semantic-substantiation/plan.md).
73+
[specs/020-deterministic-claim-caching/plan.md](specs/020-deterministic-claim-caching/plan.md).
7474
<!-- SPECKIT END -->

agents/prompts/panels/panel_plan_data_resources.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,13 @@ the deterministic dataset-URL-reachability check.
1616
- **Compute / tooling fit**: the planned analysis must be runnable with the
1717
free-model + free-compute constraints llmXive imposes. Plans that assume
1818
GPT-4 / paid voyage embeddings / >100 GPU-hours are infeasible.
19+
- **Cite the source, don't pre-assert the number**: a planning doc must cite the
20+
source/reference for any data resource or quantity rather than asserting a
21+
specific empirical count/value. Do NOT flag or kick back a planning doc merely
22+
for omitting a specific empirical number (exact counts, dataset sizes, measured
23+
quantities) — those are established in the implementation/research phase, not in
24+
planning. Flag only when a cited resource is wrong, inappropriate, or
25+
unreferenced.
1926

2027
You do NOT judge whether the method is sound (`methodology`), whether the
2128
spec is covered (`spec_coverage`), or whether internal docs cohere

notes/spec-015-review-status.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -543,3 +543,51 @@ The 3-part F-14/F-20-B design, built TDD, offline-gate green. Part A still OPEN.
543543
**Verification:** ruff + mypy clean. Offline gate **2140 passed** / 11 skipped / 2 deselected (baseline **2107** + 33 new; ZERO regression → SC-008; includes test_exact_count_no_regress, test_grounding_service, test_fill_extract_gate, test_claim_resolve_dispatch, test_llm_call_centralization all green). **Live real-call matrix 5/5 PASSED (54s, real Dartmouth):** Almoravid-block (SC-001), Paris-grounded (SC-004), Sydney-contradicted (SC-005), bound-preguard (SC-006), STRUCTURED-skip (SC-002/003 by construction). New tests: test_fill_channels_kind (14), test_fill_relevance (5), test_fill_extract_gate +TestAcceptGate (5), test_fill_claimkind_preguard (6), test_claim_canonical +TestSubjectKeywordsPublic (2), tests/real_call/test_semantic_substantiation (5).
544544

545545
**The trustworthiness stack is now complete:** 016 detect → 017 fill → 018 verify-modes → **019 PROSE must be semantically substantiated (subject↔value asserted, not a coincidental digit match)**.
546+
547+
## Spec 020 — Deterministic Claim Caching + Planning Reference-Only (IN PROGRESS) — 2026-06-04
548+
549+
Two maintainer-identified problems: (1) claim WAFFLING (a value made→flagged→corrected→
550+
overwritten→re-flagged in a loop); (2) low-level claims BLOCKING planning (the PROJ-552
551+
"49 vs 9,988" kickback loop over a number that doesn't gate progress).
552+
553+
Pipeline run via /speckit-execute: plan→tasks→analyze (7 findings, all fixed)→implement.
554+
555+
**DONE + verified (offline gate 2198 passed, 0 fail; baseline was 2165 — no regression):**
556+
- **US1 (FR-001/002/003/004)** — planning = references-only + strip/smooth. `claims/stage.py`
557+
`is_planning_stage()` (planning = spec/clarify/plan/tasks). `claims/smooth.py`
558+
`strip_and_smooth()` (LLM rewrite → deterministic re-detect guard → clause-removal
559+
fallback; idempotent, citations preserved). `process_document(stage_label=)` planning
560+
branch: extract to FIND low-level claims, strip/smooth them, NO resolve/fill/ground/
561+
marker/kickback. References still gated by the separate F-18/validate_artifact path.
562+
Stage threaded via `SlashCommandAgent.claim_stage_label()` (NOT derivable from
563+
slash_command_name — plan_cmd & paper_plan_cmd share "speckit.plan"). Fill-boundary
564+
gate (channels_for/fill_claim stage_label) as defense-in-depth.
565+
- **US2 freeze (FR-009/010/011/013)**`state/claims.load_verified_by_subject()` frozen
566+
(kind, subject_key) index; `resolve_registered_claims` adopts a VERIFIED subject-twin
567+
WITHOUT re-resolving (closes the PENDING-with-verified-twin re-resolution gap → no
568+
re-open on transient failure). state/claims/ git-tracked (cross-run), grounding-cache
569+
gitignored (within-run only).
570+
- **US2 cache key (FR-012, partial)** — dropped `resolved_value` from the fill verdict key
571+
(the safe part). The stronger "different asserted values share a key" needs hardening the
572+
shared `canonical._asserted_value` disambiguation (broad blast radius) — scoped, not done.
573+
- **US3 (FR-006)** — templates/skills/data-resources panel defer empirical specifics; PROJ-552
574+
per-project template copies synced byte-identical.
575+
576+
**FR-007/008, SC-007 — durable placeholder: IMPLEMENTED** (maintainer chose "implement now").
577+
`render(placeholder_verified=True)` keeps a durable `{{claim:id}}` in the canonical stored form;
578+
`render_view`/`render_artifact_view` substitute values for the human/published view from the frozen
579+
store; `strip_claim_artifacts(preserve_pointers=True)` keeps placeholders; `process_document`
580+
carries over prior-round placeholders + drops orphans (round-trip is a fixed point — SC-007). The
581+
proven-good value-correction path is PRESERVED: `render()`'s default mode is unchanged (all existing
582+
render tests green), and citation repair re-anchors on the placeholder. Per clarification Q4
583+
"convergence operates on the placeholder form", the LLM panel/reviser operate on placeholders (NOT
584+
render_view in the engine — that would re-persist baked values); the published paper prose does NOT
585+
pass through `process_document`, so it never carries placeholders. The reviser self-consistency claim
586+
pass was also threaded with the planning stage (completing US1 in the convergence loop). Only two
587+
offline tests needed updating to the deliberately-changed contract (test_double_run_is_stable,
588+
test_fill_render_repairs_citation); the proven-good render tests were untouched. Full offline gate
589+
2211 passed / 0 failed. ALL 35 tasks complete.
590+
591+
Commits: c77de3fa (plan) 4b2cf2c4 (tasks+analyze) 4a06d0cc (US1) 16e44ee9 (US2 freeze+key)
592+
58877524 (US3+real-call tests) 8cb9771e+112eeb22 (real-call fixes) 2920cf1f (durable placeholder)
593+
081e74f4 (reviser stage threading). Real-call sign-off: free model = qwen.qwen3.5-122b.

0 commit comments

Comments
 (0)