Skip to content
Open
Show file tree
Hide file tree
Changes from 33 commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
b218417
feat: add CI operational checkpoint schema
safal207 Jul 2, 2026
54e0102
feat: add CI operational checkpoint example
safal207 Jul 2, 2026
7b3cbf3
feat: add deterministic checkpoint evaluator
safal207 Jul 2, 2026
4d00568
test: add CI checkpoint conformance cases
safal207 Jul 2, 2026
b082991
docs: add CI checkpoint outcome registry
safal207 Jul 2, 2026
37d9a8b
docs: define CI operational checkpoint contract
safal207 Jul 2, 2026
f1dc1e9
ci: add agent continuity conformance workflow
safal207 Jul 2, 2026
166498a
docs: add CI checkpoint profile to continuity README
safal207 Jul 2, 2026
5c1677d
fix: preserve checkpoint proof and workspace evidence
safal207 Jul 2, 2026
2f975ba
test: cover checkpoint lineage and workspace evidence
safal207 Jul 2, 2026
324c61a
fix: make dirty-state optional and require evidence refs
safal207 Jul 2, 2026
100d6f8
docs: preserve proof lineage and explicit workspace evidence
safal207 Jul 2, 2026
79ee81b
docs: register checkpoint lineage and workspace codes
safal207 Jul 2, 2026
a62bed7
fix: require verified parent checkpoint lineage
safal207 Jul 2, 2026
d9514ca
test: require full parent checkpoint
safal207 Jul 2, 2026
27f6f52
test: validate parent checkpoint integrity
safal207 Jul 2, 2026
d4a8878
docs: register verified parent lineage codes
safal207 Jul 2, 2026
bdbcdf7
docs: require verified parent lineage
safal207 Jul 2, 2026
b26e66c
fix: preserve objective constraints and pending verification
safal207 Jul 2, 2026
be56545
test: preserve active checkpoint state
safal207 Jul 2, 2026
e3e2a19
docs: register active-state lineage codes
safal207 Jul 2, 2026
0b11b69
docs: preserve active checkpoint state
safal207 Jul 2, 2026
ce7cd8a
fix: anchor checkpoint example evidence to commit
safal207 Jul 2, 2026
6a1e51b
fix: harden checkpoint parent link invariants
safal207 Jul 2, 2026
14ff094
docs: register checkpoint link invariant code
safal207 Jul 2, 2026
08fdb3d
fix: reject parent authority bypass
safal207 Jul 2, 2026
3791135
test: reject parent authority bypass
safal207 Jul 2, 2026
0a5fef1
fix: centralize checkpoint integrity guards in core
safal207 Jul 2, 2026
28b78e5
fix: make cached schema loader non-recursive
safal207 Jul 2, 2026
9dc8027
fix: preserve canonical checkpoint validation order
safal207 Jul 3, 2026
79109f4
refactor: remove preemptive facade validation
safal207 Jul 3, 2026
d806ce6
test: preserve checkpoint diagnostic priority
safal207 Jul 3, 2026
4a07a52
test: align empty evidence with schema precedence
safal207 Jul 3, 2026
f5a7a00
noop
safal207 Jul 3, 2026
65d4672
chore: remove accidental temporary file
safal207 Jul 3, 2026
1923353
fix: make parent hook reload-idempotent
safal207 Jul 3, 2026
9f1059b
test: cover reload-idempotent parent hook
safal207 Jul 3, 2026
48d043c
fix: reject whitespace-prefixed memory evidence
safal207 Jul 3, 2026
02f1040
test: normalize memory evidence prefixes
safal207 Jul 3, 2026
b0461bf
test: isolate parent memory evidence guard
safal207 Jul 3, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions .github/workflows/agent-continuity-conformance.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Agent Continuity conformance

on:
pull_request:
paths:
- "standards/agent-continuity/**"
- ".github/workflows/agent-continuity-conformance.yml"
push:
paths:
- "standards/agent-continuity/**"
- ".github/workflows/agent-continuity-conformance.yml"
workflow_dispatch:

permissions:
contents: read

jobs:
conformance:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: false

- name: Set up Python
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
with:
python-version: "3.12"

- name: Install conformance dependency
run: |
python -m pip install --disable-pip-version-check \
-r standards/agent-continuity/conformance/requirements.txt

- name: Run Agent Continuity conformance suite
run: |
python -m unittest discover \
-s standards/agent-continuity/conformance \
-p 'test_*.py' \
-v
29 changes: 29 additions & 0 deletions standards/agent-continuity/CI-CHECKPOINT-CODES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# CI Operational Checkpoint v0.1 Outcome Registry

Consumers MUST branch on `outcome` and `reason_code`, not on `detail`.

## Outcomes

| Outcome | Meaning |
|---|---|
| `CONTINUE` | The checkpoint is valid, lineage is coherent, the workspace matches, and the next step may resume as context-only work. |
| `REVALIDATE_WORKSPACE` | Repository identity matches, but required workspace evidence is missing or base, head, or dirty-state evidence changed. |
| `RESTART_REQUIRED` | The checkpoint cannot safely resume in the current workspace or failed schema/digest validation. |
| `IDEMPOTENT_REPLAY` | The same checkpoint was already consumed; no duplicate work should be created. |
| `REJECT_LINEAGE_MISMATCH` | Parent, checkpoint identity, time, objective, constraints, sequence, trajectory, rejected-approach continuity, or parent integrity is inconsistent. |
| `REJECT_UNVERIFIED_COMPLETION` | Verification was completed without durable evidence, disappeared, or conflicts with prior proof or pending-work lineage. |
| `REJECT_INVALID_AUTHORITY` | Continuity material attempted to carry action authority or bypass fresh authorization. |

## Reason codes

| Outcome | Reason code |
|---|---|
| `CONTINUE` | `CONTINUE_OK` |
| `REVALIDATE_WORKSPACE` | `WORKSPACE_STATE_CHANGED`, `CURRENT_WORKSPACE_FIELD_MISSING` |
| `RESTART_REQUIRED` | `SCHEMA_INVALID`, `DIGEST_MISMATCH`, `WORKSPACE_IDENTITY_MISMATCH`, `CURRENT_WORKSPACE_FIELD_MISSING` |
| `IDEMPOTENT_REPLAY` | `CHECKPOINT_ALREADY_CONSUMED` |
| `REJECT_LINEAGE_MISMATCH` | `ROOT_HAS_PARENT`, `PARENT_REQUIRED`, `PARENT_NOT_FOUND`, `PREVIOUS_CHECKPOINT_REQUIRED`, `PREVIOUS_CHECKPOINT_SCHEMA_INVALID`, `PREVIOUS_CHECKPOINT_DIGEST_MISMATCH`, `PREVIOUS_CHECKPOINT_SEMANTIC_INVALID`, `CHECKPOINT_ID_REUSED`, `PARENT_MISMATCH`, `SEQUENCE_MISMATCH`, `TRAJECTORY_CHANGED`, `CREATION_TIME_REGRESSED`, `OBJECTIVE_CHANGED`, `CONSTRAINT_LOST`, `REJECTED_APPROACH_ID_DUPLICATED`, `REJECTED_APPROACH_LOST`, `REJECTED_APPROACH_CHANGED` |
| `REJECT_UNVERIFIED_COMPLETION` | `VERIFICATION_ID_DUPLICATED`, `VERIFICATION_SET_MISMATCH`, `COMPLETION_EVIDENCE_MISSING`, `MEMORY_IS_NOT_VERIFICATION`, `COMPLETED_VERIFICATION_LOST`, `COMPLETED_VERIFICATION_CHANGED`, `PENDING_VERIFICATION_LOST`, `PENDING_VERIFICATION_CHANGED` |
| `REJECT_INVALID_AUTHORITY` | `AUTHORITY_NOT_CONTEXT_ONLY`, `FRESH_AUTHORITY_REQUIRED` |

Within version `0.1`, existing reason codes MUST NOT change meaning.
107 changes: 107 additions & 0 deletions standards/agent-continuity/CI-OPERATIONAL-CHECKPOINT-V0.1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
# CI Operational Checkpoint v0.1

- **Status:** Draft
- **Profile:** `pythia.ci_operational_checkpoint.v0.1`
- **Parent:** [RFC-001](RFC-001-VERIFIABLE-CONTINUATION-ENVELOPE.md)
- **Scope:** CI/CD phase transitions, retries, restart, and agent handoff

## Purpose

This profile defines a bounded checkpoint for resuming delivery work without
reconstructing state from narrative memory and without inheriting authority for
a consequential action.

```text
validate schema and digest
-> check replay
-> validate parent checkpoint and lineage
-> preserve objective, constraints, rejected rationale, and verification proof
-> compare current workspace
-> CONTINUE | REVALIDATE | RESTART | IDEMPOTENT_REPLAY | REJECT
```

## Core boundary

> Context may continue. Authority must be evaluated again.

`authority` is fixed to `context_only`. Merge and deploy intent MUST set
`requires_fresh_authority=true`. A checkpoint never replaces an Action Envelope,
current checks, current reviews, or an executor guard.

## Required content

A conforming checkpoint records trajectory and parent identity, source agent and
session, repository and workspace identity, objective, phase, constraints,
rejected approaches, touched resources, verification state, the next action,
and a canonical SHA-256 digest. `dirty_state_digest` is optional.

The strict schema is
[`schema/ci-operational-checkpoint-v0.1.schema.json`](schema/ci-operational-checkpoint-v0.1.schema.json).

## Active-state continuity

Within one trajectory:

- child creation time MUST NOT precede parent creation time;
- objective and acceptance criteria MUST remain unchanged;
- every prior `must` and `must_not` constraint MUST remain active;
- every rejected approach row and rationale MUST remain unchanged;
- every completed verification target and prior evidence reference MUST remain;
- every pending verification MUST remain with the same target or move to
completed with durable evidence.

Constraints and evidence may be added. Existing active state and proof may not be
silently removed or rewritten. A changed objective requires a new trajectory.

## Verification boundary

Completed verification requires durable evidence. Memory and agent summaries
are not verification evidence, regardless of URI-scheme letter case. Additional
evidence may be appended, but existing evidence cannot be removed or replaced.

## Parent-checkpoint integrity

Every non-root resume requires the full previous checkpoint. A known parent ID
alone is insufficient because it cannot prove active-state or verification
continuity.

Before comparison, the previous checkpoint MUST pass schema validation,
canonical digest verification, identifier uniqueness, verification-set
consistency, and the memory-evidence boundary. Invalid or missing parent material
returns `REJECT_LINEAGE_MISMATCH`.

Durable lookup and storage remain follow-up work in issue #223.

## Workspace comparison

A repository or working-directory mismatch returns `RESTART_REQUIRED`. Changes
to base ref, head SHA, or a declared dirty-state digest return
`REVALIDATE_WORKSPACE`.

When the checkpoint declares `dirty_state_digest`, the resumed runtime MUST
explicitly report it, including `null` for an observed clean workspace. Missing
observation returns `CURRENT_WORKSPACE_FIELD_MISSING`. If the checkpoint omits
the field, it is outside the comparison boundary.

## Replay

A consumed checkpoint ID returns `IDEMPOTENT_REPLAY`; completed work must not be
repeated.

## Relationship to Action Envelope V1

The checkpoint says what context and verification state to restore. Action
Envelope V1 decides whether an exact consequential action may execute now. The
contracts are complementary and non-substitutable.

## Reference files

- example: [`examples/ci-operational-checkpoint-v0.1.example.json`](examples/ci-operational-checkpoint-v0.1.example.json)
- evaluator: [`conformance/ci_operational_checkpoint_reference.py`](conformance/ci_operational_checkpoint_reference.py)
- tests: [`conformance/test_ci_operational_checkpoint.py`](conformance/test_ci_operational_checkpoint.py)
- codes: [`CI-CHECKPOINT-CODES.md`](CI-CHECKPOINT-CODES.md)

## Non-claims

This profile is not durable storage, a distributed lease, proof of execution, or
permission for a tool call.
45 changes: 37 additions & 8 deletions standards/agent-continuity/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Agent Continuity & Authority

Vendor-neutral specifications and executable conformance checks for preserving operational continuity across context compaction, session restart, and cross-session handoff.
Vendor-neutral specifications and executable conformance checks for preserving operational continuity across context compaction, session restart, cross-session handoff, and CI/CD phase transitions.

## RFC v0.1

Expand All @@ -10,6 +10,30 @@ defines a bounded, structured envelope that carries the active operational tail

A separate restore-results document records which required reads and evidence checks were actually completed. The envelope declares the gate; restore results satisfy it.

## CI Operational Checkpoint v0.1

[`CI-OPERATIONAL-CHECKPOINT-V0.1.md`](./CI-OPERATIONAL-CHECKPOINT-V0.1.md)

specializes the continuity boundary for agentic CI/CD work. It records exact
workspace identity, goal, constraints, rejected approaches, verification state,
and the next action while fixing authority to `context_only`.

The profile deterministically returns:

```text
CONTINUE
REVALIDATE_WORKSPACE
RESTART_REQUIRED
IDEMPOTENT_REPLAY
REJECT_LINEAGE_MISMATCH
REJECT_UNVERIFIED_COMPLETION
REJECT_INVALID_AUTHORITY
```

A checkpoint may preserve the intent to merge or deploy, but it cannot authorize
that action. A fresh Action Envelope and current exact-target evidence remain
mandatory.

## Problem

Coding agents may lose task continuity after compaction or handoff. They can repeat completed work, violate recent constraints, forget rejected approaches, or confidently reconstruct an execution history that is not supported by durable evidence.
Expand All @@ -21,10 +45,12 @@ Coding agents may lose task continuity after compaction or handoff. They can rep
## Package

- RFC specification;
- JSON Schemas for the envelope and restore results;
- example envelope and restore results;
- reference validator;
- executable conformance tests.
- CI operational checkpoint profile;
- JSON Schemas for envelopes, restore results, and CI checkpoints;
- complete examples;
- deterministic reference validators;
- executable conformance tests;
- stable CI checkpoint outcome registry.

## Quick validation

Expand All @@ -39,16 +65,19 @@ python -m unittest discover \
## What the suite verifies

- published JSON Schema enforcement;
- canonical envelope digest integrity;
- canonical envelope and checkpoint digest integrity;
- trusted-source authority boundaries;
- independent digest/receipt evidence checks;
- required-read completion;
- fail-closed restore behavior;
- unresolved task verification remaining unresolved.
- unresolved task verification remaining unresolved;
- CI workspace drift detection;
- lineage, replay, rejected-approach, and verification continuity;
- fresh authorization requirements for merge and deploy intent.

## Intended integrations

The specification is implementation-neutral. Codex, Claude Code, IDE agents, CLI agents, and multi-agent runtimes may store or transport the envelope differently while preserving the same observable guarantees.
The specifications are implementation-neutral. Codex, Claude Code, IDE agents, CLI agents, CI bots, and multi-agent runtimes may store or transport the envelopes differently while preserving the same observable guarantees.

## Status

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
from __future__ import annotations

from typing import Any, Iterable, Mapping

import ci_operational_checkpoint_reference_core as _core
from ci_operational_checkpoint_reference_core import * # noqa: F401,F403


def evaluate_resume(
checkpoint: Mapping[str, Any],
*,
current_workspace: Mapping[str, Any],
previous_checkpoint: Mapping[str, Any] | None = None,
seen_checkpoint_ids: Iterable[str] = (),
known_parent_ids: Iterable[str] = (),
) -> dict[str, str]:
"""Delegate to the canonical core evaluator without pre-validation."""

return _core.evaluate_resume(
checkpoint,
current_workspace=current_workspace,
previous_checkpoint=previous_checkpoint,
seen_checkpoint_ids=seen_checkpoint_ids,
known_parent_ids=known_parent_ids,
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
from __future__ import annotations

from typing import Any, Iterable, Mapping

import ci_operational_checkpoint_reference_impl as _impl
from ci_operational_checkpoint_reference_impl import * # noqa: F401,F403

_result = _impl._result
_schema_errors = _impl._schema_errors
_ORIGINAL_PREVIOUS_CHECKPOINT_INTEGRITY_ERROR = (
_impl._previous_checkpoint_integrity_error
)


def _previous_checkpoint_integrity_error(
previous_checkpoint: Mapping[str, Any],
) -> tuple[str, str] | None:
"""Extend parent integrity after canonical schema and digest validation."""

error = _ORIGINAL_PREVIOUS_CHECKPOINT_INTEGRITY_ERROR(previous_checkpoint)
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Outdated
if error is not None:
return error

sequence = previous_checkpoint["sequence"]
parent_id = previous_checkpoint["parent_checkpoint_id"]
checkpoint_id = previous_checkpoint["checkpoint_id"]
if sequence == 0 and parent_id is not None:
return (
"PREVIOUS_CHECKPOINT_SEMANTIC_INVALID",
"root previous checkpoint must not declare a parent",
)
if sequence > 0 and parent_id is None:
return (
"PREVIOUS_CHECKPOINT_SEMANTIC_INVALID",
"non-root previous checkpoint must declare a parent",
)
if parent_id is not None and checkpoint_id == parent_id:
return (
"PREVIOUS_CHECKPOINT_SEMANTIC_INVALID",
"previous checkpoint cannot be its own parent",
)

for row in previous_checkpoint["verification"]["completed"]:
if not row["evidence_refs"]:
return (
"PREVIOUS_CHECKPOINT_SEMANTIC_INVALID",
f"{row['verification_id']} has no evidence references",
)

next_action = previous_checkpoint["next_action"]
if (
next_action["action_class"] in {"merge", "deploy"}
and not next_action["requires_fresh_authority"]
):
return (
"PREVIOUS_CHECKPOINT_SEMANTIC_INVALID",
"parent merge or deploy intent requires fresh authority",
)
return None
Comment thread
coderabbitai[bot] marked this conversation as resolved.


# Install the enhanced parent hook into the canonical ordered implementation.
_impl._previous_checkpoint_integrity_error = _previous_checkpoint_integrity_error


def evaluate_resume(
checkpoint: Mapping[str, Any],
*,
current_workspace: Mapping[str, Any],
previous_checkpoint: Mapping[str, Any] | None = None,
seen_checkpoint_ids: Iterable[str] = (),
known_parent_ids: Iterable[str] = (),
) -> dict[str, str]:
"""Preserve canonical validation order and stable authority diagnostics."""

errors = _schema_errors(checkpoint)
authority_error = next(
(
error
for error in errors
if list(error.absolute_path) == ["authority"]
),
None,
)
if authority_error is not None:
return _result(
REJECT_INVALID_AUTHORITY,
"AUTHORITY_NOT_CONTEXT_ONLY",
authority_error.message,
)

result = _impl.evaluate_resume(
checkpoint,
current_workspace=current_workspace,
previous_checkpoint=previous_checkpoint,
seen_checkpoint_ids=seen_checkpoint_ids,
known_parent_ids=known_parent_ids,
)

if result["outcome"] == CONTINUE:
sequence = checkpoint["sequence"]
if (
sequence > 0
and checkpoint["checkpoint_id"] == checkpoint["parent_checkpoint_id"]
):
return _result(
REJECT_LINEAGE_MISMATCH,
"CHECKPOINT_ID_REUSED",
"a checkpoint cannot reuse its parent checkpoint ID",
)
return result
Loading
Loading