Skip to content

[anneal] Add more thorough agent documentation#3489

Open
joshlf wants to merge 1 commit into
Gaso4is5l3ore5u3xhbeclucymmqjxqz7from
Gbzsorhgbclv3optfx2dkxjelijhcdfds
Open

[anneal] Add more thorough agent documentation#3489
joshlf wants to merge 1 commit into
Gaso4is5l3ore5u3xhbeclucymmqjxqz7from
Gbzsorhgbclv3optfx2dkxjelijhcdfds

Conversation

@joshlf

@joshlf joshlf commented Jul 17, 2026

Copy link
Copy Markdown
Member

Latest Update: v3 — Compare vs v2

📚 Full Patch History

Links show the diff between the row version and the column version.

Version v2 v1 Base
v3 vs v2 vs v1 vs Base
v2 vs v1 vs Base
v1 vs Base
⬇️ Download this PR

Branch

git fetch origin refs/heads/Gbzsorhgbclv3optfx2dkxjelijhcdfds && git checkout -b pr-Gbzsorhgbclv3optfx2dkxjelijhcdfds FETCH_HEAD

Checkout

git fetch origin refs/heads/Gbzsorhgbclv3optfx2dkxjelijhcdfds && git checkout FETCH_HEAD

Cherry Pick

git fetch origin refs/heads/Gbzsorhgbclv3optfx2dkxjelijhcdfds && git cherry-pick FETCH_HEAD

Pull

git pull origin refs/heads/Gbzsorhgbclv3optfx2dkxjelijhcdfds

Stacked PRs enabled by GHerrit.

@codecov-commenter

codecov-commenter commented Jul 17, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.85%. Comparing base (95f3603) to head (46856a9).

Additional details and impacted files
@@                        Coverage Diff                         @@
##           Gaso4is5l3ore5u3xhbeclucymmqjxqz7    #3489   +/-   ##
==================================================================
  Coverage                              91.85%   91.85%           
==================================================================
  Files                                     20       20           
  Lines                                   6093     6093           
==================================================================
  Hits                                    5597     5597           
  Misses                                   496      496           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@joshlf
joshlf force-pushed the Gbzsorhgbclv3optfx2dkxjelijhcdfds branch from 86af9d1 to 2b0a531 Compare July 17, 2026 18:09
gherrit-pr-id: Gbzsorhgbclv3optfx2dkxjelijhcdfds
@joshlf
joshlf force-pushed the Gbzsorhgbclv3optfx2dkxjelijhcdfds branch from 2b0a531 to 46856a9 Compare July 17, 2026 18:14
Comment thread anneal/AGENTS.md
Comment on lines +34 to +35
Read [the design principles](docs/design/principles.md) for the project's value
function and [the settled requirements](docs/design/settled-requirements.md) for

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
Read [the design principles](docs/design/principles.md) for the project's value
function and [the settled requirements](docs/design/settled-requirements.md) for
Read [the design principles](docs/design/principles.md) for principles that guide all
design decisions and
[the settled requirements](docs/design/settled-requirements.md) for

Comment thread anneal/AGENTS.md
4. The [accepted-decision index](docs/design/decisions/README.md) and each
accepted decision relevant to the change.
5. [Verification model](docs/design/verification-model.md),
[verification subject and result identity](docs/design/verification-artifact.md), and

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The link text here doesn't make sense to me. Is there a different way of wording what is contained in the linked document?

Comment thread anneal/AGENTS.md
Comment on lines +69 to +108
## How to make judgment calls

Apply these rules together rather than as a rigid total ordering:

- Preserve soundness. Do not gain simplicity, coverage, or convenience by
weakening a soundness obligation or silently adding trust.
- Preserve semantic fidelity. A simple model is valuable only while it
faithfully supports the claim Anneal makes. Resource ownership, provenance,
initialization, concurrency protocols, or effects must not become freely
duplicable facts when doing so could invalidate soundness.
- Prefer local, compositional reasoning. The key scalability property is that
an implementation can be checked against an abstraction boundary and then
used without re-examining the whole program.
- Prefer the simplest faithful abstraction. Pure functional contracts are
excellent where they capture the interface; resource- or effect-aware
interfaces are required where purity would discard soundness-relevant facts.
- Make trust explicit and auditable. A trusted leaf can be a legitimate
engineering boundary; a hidden assumption or uncovered operation cannot.
- Build on maintained Lean, Aeneas, and Charon abstractions when they fit.
Reinvention is permitted, but should carry a concrete benefit that outweighs
duplicated semantics and maintenance.
- Prefer robust programmatic interfaces over textual patching. Upstream changes
to Aeneas, Charon, Lean libraries, and Rust itself are in scope. Choose
upstream or downstream ownership case by case, including the burden placed on
collaborators.
- Optimize for useful coverage, evolvability, debuggability, and eventual use
by ordinary Rust engineers. AI assistance is expected to help, but may not be
used to excuse an incoherent or unauditable interface.
- Support incremental adoption without confusing an assumption with a proof.
Prose safety justifications and incomplete proofs must remain visible in the
resulting trust or coverage report.
- Fail closed relative to the exact claim and command mode being reported.
Unsupported semantics, missing coverage, or an undischarged obligation may
never produce an unconditional verification claim. An explicitly named
incremental mode may report a weaker conditional result only when every
assumption and incomplete obligation is part of that result; command names
and exit policies remain open.

When principles conflict, state the conflict and justify the tradeoff in those
terms. Do not invent a permanent priority ordering from one local decision.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Should some or all of this live in the principles documentation instead?

Comment thread anneal/AGENTS.md
excellent where they capture the interface; resource- or effect-aware
interfaces are required where purity would discard soundness-relevant facts.
- Make trust explicit and auditable. A trusted leaf can be a legitimate
engineering boundary; a hidden assumption or uncovered operation cannot.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

"uncovered" has a conventional meaning that is not what we intend; maybe more verbose is better? Something like "... or an operation that is ignored or not covered by proof reasoning logic"?

Comment thread anneal/AGENTS.md
Comment on lines +88 to +89
Reinvention is permitted, but should carry a concrete benefit that outweighs
duplicated semantics and maintenance.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Should we specifically ask agents to flag abstractions that could be upstreamed to Lean, Aeneas, and/or Charon?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Agreed. I'm not sure where best to put this guidance.

Comment thread anneal/AGENTS.md
Comment on lines +115 to +122
- `docs/design/` states the normative intent.
- Accepted records in `docs/design/decisions/` capture settled choices and
their rationale.
- `docs/design/open-questions/` records constraints, candidates, and evidence,
not decisions.
- `docs/reference/` describes the checked-in implementation and may change as
the code changes.
- `docs/history/` is evidence, not authority.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Is this valuable if agents are going to go read the linked README.md that says as much anyway?

Comment thread anneal/AGENTS.md
project authors. With that agreement, add or update an accepted decision record
and reconcile the normative documents. Without it, keep the record proposed,
describe the implementation as an experiment, or stop and surface the choice.
If documents conflict, surface the conflict instead of silently selecting the

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

There is a technical notion of "conflict" that we don't want to mistakenly imply here. Maybe something like "the decisions in different documents" or "the proposals in different documents" or something?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Maybe "disagree"?

Comment thread anneal/AGENTS.md
Comment on lines +135 to +141
- the final property/outcome taxonomy;
- whether proof obligations are encoded as Lean arguments or sidecar theorems;
- how Anneal's property tracking builds on or parallels Rust's `unsafe`
machinery;
- the annotation and proof-authoring syntax;
- the precise boundary among Anneal, Aeneas, Charon, and rustc;
- the exact audit-ledger schema and success modes of `cargo anneal verify`.

@mdittmer mdittmer Jul 17, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This is likely to change. Should we "trust the content of docs/design/open-questions" (or whatever the path is) rather than put a one-off list here?

Comment thread anneal/AGENTS.md
Comment on lines +146 to +167
## Current implementation

The checked-in V2 executable currently provides toolchain setup scaffolding;
much of the intended verification pipeline is not yet present on this branch.
Open and stacked PRs may contain additional implementation, but are not the
source of truth for the checked-in tree. See
[current architecture](docs/reference/current-architecture.md).

From the repository root, useful checks are:

```bash
cargo test --locked --manifest-path anneal/Cargo.toml
cargo fmt --check --manifest-path anneal/Cargo.toml --all
PYTHONDONTWRITEBYTECODE=1 python3 -m unittest discover -s anneal/tests -p 'test_*.py'
bash anneal/check-flake-eval.sh
```

Tests behind the `exocrate_tests` feature expect CI to place a prebuilt archive
at `anneal/target/anneal-exocrate.tar.zst`.

V1 has different commands and a different architecture. Follow
`anneal/v1/AGENTS.md` when working there.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I have observed that agents are pretty good t deducing "useful checks" (including adjustments needed to environment, features, etc. when documentation is wrong). Between that, and my bias against putting something in here that can bitrot or drift relative to more authoritative sources liek docs/design/**, I wonder whether we should omit this. If an agent needs to know the current state, they should look at git history, open issues, open PRs, and documents. I would suggest either omitting this section, or replacing it with a suggestion stating "how to find current state/conventions" instead of what they are.

Comment thread anneal/AGENTS.md

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Recording a general observation discussed w/ @mdittmer: There is a lot of the current state of the repo encoded in this and other agent files that risks bit rotting or drifting. We should consider how much of that could be easily reconstructed by either reading the code directly or by reading documentation which lives "closer" to the code and is more likely to be kept up to date.

Comment thread anneal/docs/glossary.md
outcomes carry which postconditions is part of the open property/outcome
design.

**Callee obligation**

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Why is this not referred to as "caller obligation" given that it's an obligation placed on the caller?

Comment thread anneal/docs/glossary.md
Comment on lines +92 to +98
: The property that an implementation faithfully realizes its declared
interface in every client context covered by the claim. The coverage envelope
must be explicit: concrete calls in one compilation subject and a reusable
theorem quantified over downstream safe clients are different claims. Anneal
uses contextual refinement as the durable interpretation of the locality
behind safe encapsulation, rather than requiring literal syntactic
substitution of implementations.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This is pretty abstract. More plain language or examples might help clarify.

Comment on lines +58 to +59
The promise of safe Rust is that any type-checked use of a safe API from sound
safe code remains sound. An implementation using unsafe code can uphold this

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Suggested change
The promise of safe Rust is that any type-checked use of a safe API from sound
safe code remains sound. An implementation using unsafe code can uphold this
The promise of safe Rust is that any type-checked use of a safe API from
safe code remains sound. An implementation using unsafe code can uphold this

- Lessons from V1 should be distilled into V2 history documents instead of
requiring contributors to reverse-engineer the prototype.

## Alternatives considered

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Delete this section - none of these were actually considered, and this fails to capture the reasoning. The reasoning isn't all that important now that we've made this decision anyway.

Comment thread anneal/README.md
# Anneal

Anneal is being built to help Rust developers prove that unsafe implementations
uphold the guarantees expected of safe Rust.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

We don't need to hedge here; that's what the big status comment below is for.

Suggested change
uphold the guarantees expected of safe Rust.
Anneal helps Rust developers prove that unsafe implementations
uphold the guarantees expected of safe Rust.

Also, should we frame safety from unsafe code as a primary (and obligatory) use case for a general verification framework that embeds assertions and proofs in rust code?

Comment thread anneal/README.md
must uphold that safety promise even when it uses unsafe code internally.

Unsafe Rust lets a programmer perform operations that the compiler cannot
prove are valid. Each such operation comes with requirements: a pointer might

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

"valid" has a technical meaning in formal logic. Should we use "safe" instead?

Comment thread anneal/README.md

Because `get_byte` is a safe function, callers may pass any `usize`. An
out-of-bounds call may panic at the assertion, but it must never cause undefined
behavior. A safe API cannot place a hidden safety requirement on its caller.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

"cannot" implies impossibility, which doesn't seem quite right. Perhaps "must not" is stronger than "should not", but does not imply impossibility?

Comment thread anneal/README.md
Comment on lines +55 to +56
Anneal is intended to check reasoning like this instead of trusting the comment
alone.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Perhaps "automatically check" or "programmatically check" to imply how this is achieved?

Comment thread anneal/README.md

This is intentionally a tiny example; ordinary Rust should simply use
`bytes[index]`. It stands in for implementations which cannot avoid unsafe
operations. It contains no Anneal-specific syntax because's specification and

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
operations. It contains no Anneal-specific syntax because's specification and
operations. It contains no Anneal-specific syntax because specification and

could invalidate the claim. Resource tracking is an important example, not an
exhaustive list of cases requiring richer machinery.

In particular, a separation-logic resource must not become an unrestricted

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Maybe "For example" instead of "In particular". A separation logic probably doesn't have special status among the various tools we might deploy to chip away at Aeneas's current caveats.

At a high level, a function must establish its declared guarantees under its
preconditions and must meet the required preconditions or properties of every
callee. Property kinds may depend on one another. A soundness proof may, for
example, require a non-soundness property promised by another operation.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I do not understand the use of "non-soundness property" here. Is it a typo? Can we reword for greater clarity?

rules for duplication, consumption, framing, opening, and re-establishment are
part of its meaning.

## Compose obligations, not duplicated proofs

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Maybe "Keep proofs DRY" or similar?

specifications and `step`/`step*` tactics poorly. V2 is leaning toward shared,
combined reasoning, but the precise outcome and property architecture remains
open. The lesson is to avoid needless duplication, not to prematurely ratify a
replacement taxonomy.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I'm not sure we want to reify this example here. It's quite specific, and it's not yet clear how we want to achieve the desired effect. For example, keeping those two conditions separate may end up being a good strategy, but it should be coupled with auxiliary definitions or lemmas that can be reused in both proof contexts. Making it easy to structure things that way might end up being how this principle is realized, rather than abandoning the breakdown into two proof obligations.

open. The lesson is to avoid needless duplication, not to prematurely ratify a
replacement taxonomy.

## Prefer maintained foundations

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Not to self: CONTINUE HERE. Reviewing things in more-or-less linked-from-AGENTS.md order.

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.

3 participants