Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
36 changes: 35 additions & 1 deletion .github/skills/tlalink-inspect-correspondence/SKILL.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
name: tlalink-inspect-correspondence
description: 'Inspect TlaLink source/model correspondence by inlining TLA+/PlusCal, Dafny or P declarations with resolved C# code. Use for reviewing bindings, guards, captures, cleanup, unresolved attachments or targeted agent responses; filter and page links inspect output instead of post-processing large JSON. Read-only inspection, not editing or proof approval.'
description: 'Inspect TlaLink source/model correspondence with inline TLA+/PlusCal, Dafny or P and resolved C#. Use for bindings, guards, captures, multi-step ownership/cleanup review, grouped member context, bounded callee source, unresolved attachments or targeted responses; filter and page links inspect rather than post-process large JSON. Read-only, not editing or proof approval.'
---

# Inspect correspondence without editing it
Expand Down Expand Up @@ -75,7 +75,9 @@ Reuse the same explicit context when refining the query:
| Literal name, ID or selected-code fragment | `--search <text>`; not regex or surrounding-context search |
| Earlier guard checks or sibling statements | `--section context --context block` |
| Whole member, handlers and cleanup | `--section context --context member` |
| Related attachments in source order, shared context once | `--group-by member --context member --section context` plus needed model/source sections |
| Explicit call IDs and available source-definition locations | `--section calls`; this requests call resolution automatically |
| One-level selected-source callee excerpts, deduplicated | `--section calls --callee-source true --callee-limit 5 --callee-max-lines 80` |
| Only selected output blocks | Repeat `--section model\|source\|context\|captures\|observations\|calls` |
| Smaller replies | `--include-unlinked false --limit 5`; continue with the returned `next_offset` |
| Metadata/pin details | `--view full --format json`; default compact omits fingerprints |
Expand All @@ -92,6 +94,38 @@ filters select bindings and retain their other capture entries. Different
binding IDs may intentionally observe the same C# statement at different points;
do not collapse those model actions as duplicate source locations.

## Multi-step ownership and cleanup review

1. Discover the real member ID, then start with a member filter and
`--group-by member --context member --section model --section source
--section context --section captures`. The shared map orders attachments
physically and keeps capture points distinct; it is not an execution trace.
2. Add `--section calls --callee-source true --callee-limit 5
--callee-max-lines 80` if understanding a selected call requires another
source fetch. Callee source implies call resolution; do not combine it with
`--calls false` or sections excluding calls.
3. Read the deduplicated `callee_sources` entries referenced by each call's
`callee_keys`. They are one-level declarations in the selected compilation,
not a recursively expanded program. Calls are collected from the selected
syntax, not automatically from the surrounding context excerpt.
4. Inspect `budget-omitted`, `truncated`, `declaration-only`,
`no-selected-source` and `no-declaration-id` statuses. Omitted cleanup can
invalidate a conclusion. Use `symbols describe` on an emitted ID for the
next justified step rather than blindly raising every budget or recursively
following all calls. Partial method declarations/implementation parts can
have separate catalogue entries.
5. Account for acquisitions, ownership transfers, normal/exception exits and
release attempts versus successful effects in the authored review. Grouping
and body availability do not infer those semantics. Follow relevant implicit
disposal/getters and callback/await behavior separately.

Paging remains endpoint-based: a member group may contain only part of its
matching attachments, and member-wide filtering is not whole-member coverage.
Unavailable bodies are a review boundary, not permission to invent their
effects. Even when concrete source is present, do not cross a declared
interface/environment boundary or treat a virtual body as the runtime target.
These options never introduce fault injection, scheduling hooks or execution.

## Read the result before concluding

- Check diagnostics and exit code first: `0` resolved structurally, `1`
Expand Down
7 changes: 7 additions & 0 deletions .github/skills/tlalink-source-navigation/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,13 @@ only when the complete pinned result is needed. Symbol commands do not need
- Follow emitted call targets with `show`/`describe` when a selected source body
exists. `references`/`callers` can also target metadata IDs but still search
only selected source; they do not scan framework bodies.
- When already inspecting model/C# pairs, avoid a second lookup for every helper:
use `links inspect --section calls --callee-source true --callee-limit 5
--callee-max-lines 80` with that inspection's explicit context. Review
page-local callee references, dispatch and omitted/truncated status first.
Expand only a justified next source member with `symbols describe`.
One-level callee excerpts are not recursive call/effect analysis and do not
authorize crossing a declared interface boundary.
- Use [source inventory](../../../REFERENCE.md#current-c-source-inventory)
when the question needs member-wide access/await/cleanup facts or CFG flow,
rather than replacing Roslyn analysis with regexes.
Expand Down
19 changes: 19 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,14 @@ Skills do not install tools, approve correspondence or discharge human gates.
Select the scenario explicitly for preflight as well as execution when only
that scenario is needed. Start from synthetic examples, but do not treat
their acceptance policies as requirements for a consumer system.
- Reassess existing runs with `accept` before rerunning. Review-only changes
require revisiting the affected decisions, not replaying unchanged execution.
Keep execution applicability, changed review inputs and review status separate;
never carry approval forward merely because native inputs remain current.
- Keep the established caller path spelling during an evidence campaign.
Host-equivalent paths can still produce different native cache keys or be
embedded differently in generated compiler inputs and binaries. Diagnose that
byte drift rather than rewriting receipts or weakening currentness checks.
- Report the requested claim, scope, native outcomes, evidence locations,
archive consistency, current applicability and acceptance separately.
Identify coverage gaps, uncaptured causal edges and outstanding reviews.
Expand Down Expand Up @@ -365,6 +373,17 @@ its prerequisites; see [testing](REFERENCE.md#tests-and-evidence).
Dafny verification/oracles and the individual P checker claims are not
interchangeable. State adapter availability and native test coverage
separately; missing dependencies never justify weakening requirements.
Do not restrict Dafny to arithmetic, equate TLA+ with finite TLC exploration,
or equate P with sampled schedules. Consider inductive safety for general
data/resource histories, explicit phases for races and dependencies, and
temporal/progress checks with stated environment premises. Keep language
potential separate from supported profiles and measured results. A history
theorem requires a separate argument that C# obeys its legal transitions;
lemma termination is not asynchronous progress. P's ordinary nonblocking
sends must not erase source backpressure, synchronous reentry or memory
lifetimes. Pilot overlapping approaches on one unresolved obligation and
compare proof maintenance, counterexamples, source-bridge effort and runtime
before duplicating models or assuming a different engine scales better.
- Tests cache exact selected immutable tool paths once per session, including
workflow children through an explicit test host. Hold read leases; on Unix
recheck bytes before reporting success. Keep source/configuration/generated
Expand Down
94 changes: 91 additions & 3 deletions DESIGN.md
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,23 @@ transitive body expansion. Filters/pages cannot hide validation failures or
turn an empty selection into an adequacy claim; page-to-page inputs are not
transactionally frozen.

Member grouping reuses the already resolved source attachments and merges their
physical excerpts once per containing declaration on the returned page.
Per-attachment lexical context, model identity and capture points remain
separate; source order is not runtime order or a complete member-coverage claim.
Optional callee source expansion uses the same compilation and original
declaration identities as symbol queries, including selected partial
implementation parts. It emits a deduplicated page-local catalogue with
per-call references and explicit unavailable/declaration-only statuses. Unique
declaration and physical-line budgets expose omissions and truncation rather
than hiding them or classifying them as semantic failures. Expansion is exactly
one level from calls in the selected syntax, not from arbitrary surrounding
context; no transitive effects, dynamic dispatch, exception propagation or
resource transfer are inferred. All source/compiler pins remain checked.
Public controls use independent synthetic member/handler/call fixtures and
exercise budget thresholds, generic/extension identities, partial methods,
nested functions, paging and section projection.

One schema-4 `correspondence-scope` names explicit language/input aliases and
symbol-resolved routine omission rules. Each connection has one unique
`scope::name` ID, a compiler-resolved source attachment and a native attachment.
Expand Down Expand Up @@ -401,6 +418,9 @@ integration, a causal trace or model conformance. Build projects, the harness,
compiler/source-generator behavior and OS/runtime remain trusted. Inputs exposed
at the MSBuild capture boundary are recorded; this is not a complete MSBuild
workspace or authenticated compiler/runtime closure.
The SDK version is captured from `NETCoreSdkVersion` in that same observed
build, not from an extra `dotnet --version` process in a different directory.
The archived `sdk.log` contains this build-reported value.

Source inventories can use that recorded reference closure and defines with
explicit nullable mode, rather than silently adding the tool host's framework
Expand Down Expand Up @@ -613,6 +633,24 @@ Unsupported dependencies or incomplete searches do not justify substituting
another checker or weakening an acceptance requirement. Native test coverage
is stated separately from adapter availability.

Language expressiveness, checker guarantees and integrated profiles are separate
design dimensions. Dafny supports inductive concurrent-system safety arguments,
not just arithmetic; TLA+ supports deduction as well as explicit-state checking;
P supports deductive invariants as well as schedule exploration. Unsupported
upstream backends do not become evidence stages merely by being named here.
Keep a suitable existing model when another checker can discharge its obligation;
use a focused comparison before introducing a second specification.

For history-based safety, one-step preservation and induction establish what
legal abstract executions preserve. Showing that C# produces those legal steps
is a separate source-language bridge, not a consequence of a transition guard.
Unbounded finite histories do not imply arbitrary parameters or eventual
completion. Preserve synchronous reentry, shared storage, backpressure and
effect/settlement phases when choosing an event-driven abstraction; P's ordinary
nonblocking sends, for example, do not implement a blocking I/O contract.
Cross-backend results compose only through justified relations and compatible
assumptions, never merely through passing stages.

Production hashing streams original bytes without tool-sized allocations.
The console harness installs an internal, test-session lookup only for exact
canonical paths to its selected immutable tool distributions, pinned Java
Expand All @@ -635,9 +673,19 @@ solver cost; the cache does not remove JVM startup or archive-copy costs.

## Authoritative frontends and paths

TLA+ parsing uses SANY, not a local interpreter or replacement parser. The companion
embedded in the C# bridge supplies declared variables/operator arities. The
bridge creates fresh processes
Integrated inspection may select only TLA+ targets, without initializing a
Dafny frontend or fabricating a proof binding. Its TLA+ native inventory and
formal-owned source attachments are checked against archived model/source bytes
and compiler references. Native declaration extents are recorded frontend
evidence, not a second model parser or authenticated proof of frontend behavior.
Verification/oracle commands still require selected Dafny bindings. An
inspection cannot claim proof, audit or execution outcomes, and neither an empty
manifest nor missing selected attachments can produce ready evidence.

TLA+ parsing uses SANY, not a local interpreter or replacement parser. One typed
bridge response supplies endpoints, dependencies, declared variables and operator
arities from the same SANY pass; metadata does not start a second JVM or repeat
parsing. The bridge compiles one adapter and creates fresh processes
to isolate upstream static state and cleans its own temporary compiler outputs.
SANY/PlusCal compilation and execution, TLC stages and trace matching share the
repository's `java-toolchain.json` pin through `Common/JavaToolchain.cs`.
Expand Down Expand Up @@ -859,13 +907,53 @@ not a reuse decision. The adapter version, not the TlaLink binary hash, scopes
entries, so it must change whenever TLC invocation or result interpretation
changes. Requiring passes under several fingerprint functions reduces, but does
not eliminate, fingerprint collision risk.
Stored-key input lookup uses the host filepath comparer for absolute paths and
ordinal comparison for named metadata inputs, rejecting aliased path keys.

Run metadata separates execution completion from stage outcomes and acceptance.
Acceptance rechecks exact declared stages, semantic result consistency,
artifacts, archived bytes, current inputs and required review dispositions.
Artifacts are run-relative; source paths inside a relocated project are mapped
relative to its recorded root. External tool/reference paths remain explicit.

Review-only inputs are dependencies of review decisions, not native execution.
New runs do not add required review inputs to their execution fingerprints.
For a completed run with broad input pins, acceptance can classify an input as
review-only only when a required review explicitly declares it and validated
stage evidence establishes the execution closure. Authoring documents, compiler
references, stage declarations, method-summary support and backend fingerprints
remain execution dependencies; execution wins when roles overlap. Stored TLC
keys supply its complete execution inputs. Missing, inconsistent or unknown
closures keep current-byte checks conservative. Every original archived input
is still checked, and `changed_review_inputs` exposes exempted current-file
drift without renewing any review.

Project/policy authoring is compared semantically before review-only drift is
exempted. Acceptance independently reconstructs the archived project and
validates its saved expansion, root hash and archived policy hash. Typed
projections retain the entire execution definition except review obligations,
review-directory selection and policy-document location. Every requirement
field except its review references remains in the checker-expectation
projection. New fields are retained by those record projections and unknown
JSON fields fail boundary decoding; there is no DOM field-stripping allowlist.
Complete-project comparison deliberately remains conservative about ordering,
path spellings, unused tools and other scenarios.

Only equivalent execution and checker projections permit automatic current-policy
reassessment in the existing accept/explain/report flow. The resulting typed
policy comparison links recorded/current project, policy and authoring hashes,
compatibility judgments and changed areas. Native stage/compiler/summary input
roles override this exemption, including when a stage consumed authoring bytes.
Incomplete evidence or an unknown execution closure cannot turn a changed
project into current execution. All original archived inputs and artifacts are
still checked; approvals are never inherited from different review identities
or origins. Current policy authorship remains trusted, not authenticated.

This reassesses existing provenance, writes only new acceptance/report outputs,
and does not record a new execution or introduce a backend cache. Incompatible
execution/requirement changes remain stale and require appropriate fresh
evidence; pending or stale current reviews remain separate acceptance blockers.

Review decisions are append-only sidecar records, never edits to pinned run
inputs. They pin the claim/assumptions, explicit source inputs and supporting
evidence. Claim or input drift invalidates prior review. The newest decision
Expand Down
20 changes: 17 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ checkable:
earlier results no longer apply. The agent then updates the model and
reruns the affected checks.

Before rerunning, the agent can reassess an existing run. Changes confined to
review policy or review context do not replay unchanged execution: TlaLink
checks the archived execution and checker requirements, then evaluates the
current reviews separately. New or changed reviews are never approved merely
because the execution still applies.

The goal is to move from **"the agent says this looks correct"** to **"here is
the evidence, its scope and what remains unproven."** You do not need to read
or write TLA+, Dafny or P yourself.
Expand Down Expand Up @@ -124,6 +130,9 @@ declaration alongside its selected C# code, surrounding control/lock context
and observation metadata, without changing either source. Filter by source
member, attachment status or capture point, and request only the sections
needed for the review.
Group related attachments by C# member and optionally inline bounded,
one-level selected-source callee excerpts to review multi-step cleanup paths
without repeatedly fetching the same code.
Agents can load the focused [workspace CLI skills](AGENTS.md#agent-cli-skills)
for source navigation, correspondence inspection and deliberate link maintenance.

Expand Down Expand Up @@ -160,6 +169,8 @@ TlaLink does not model a whole program at once. For a larger system:
TLC searches are reused while their models and configurations are unchanged,
like an incremental build. Expensive searches can run once, separately,
with a larger budget. See [reusing results](REFERENCE.md#reusing-completed-tlc-results).
Reassess existing runs with `accept` before executing again: review-only
document changes require fresh reviews, not fresh native execution.

Combining checks in one project is for organization and repeatability. It
does not prove that the separate results add up to a system-wide guarantee.
Expand Down Expand Up @@ -229,11 +240,14 @@ need the ones your chosen checks use.
| [Roslyn](https://github.com/dotnet/roslyn) | Resolving the C# side of the links. |
| [TLA+ tools](https://github.com/tlaplus/tlaplus) (SANY, PlusCal, TLC) | Parsing TLA+ models, exploring their states and checking recorded executions. |
| [Apalache](https://apalache-mc.org/) | Symbolic checking of TLA+ safety properties. |
| [Dafny](https://dafny.org/) | Verifying algorithms and comparing selected C# calls with verified results. |
| [Dafny](https://dafny.org/) | Proving algorithmic contracts and modeled safety invariants, including arbitrary finite histories; comparing selected C# calls with verified results. |
| [P](https://p-org.github.io/P/) | Checking asynchronous state-machine models and logs. |

Each checker gives a different kind of guarantee; the
[selection guide](REFERENCE.md#choosing-tools-and-checkers) compares them.
Choose by the question, not a fixed language ranking. General safety proofs,
interleaving exploration and eventual-progress checks need different evidence;
none automatically proves the linked C#. The
[selection guide](REFERENCE.md#choosing-tools-and-checkers) compares modeling
fit, checker guarantees and current integration limits.

## Limitations

Expand Down
Loading
Loading