Skip to main content

TraceLayer

Agent-native software traceability: intent, implementation, verification, provenance, and evidence as a deterministic graph.

CI Python uv License Tests

Marker protocol · Relationships · Concepts · Policy · Hooks · Evidence · Security

TraceLayer makes the why of software traversable. One-line trace:v1 markers declare the semantic relationships that cannot be derived — which work item produced a behavior, which requirement it satisfies, which tests intend to verify it. The engine derives everything else: AST symbol attachment, Git provenance, revision fingerprints, staleness, and runtime evidence. The result is a continuously verified trace graph that agents and reviewers can query instead of loading the whole repository.

How it works

flowchart LR
    A[trace:v1 markers] --> B[Marker parser]
    B --> C[AST symbol attachment]
    C --> D[SQLite trace graph]
    D --> E[Git provenance]
    E --> F[Fingerprints and staleness]
    F --> G[Policy evaluation]
    D --> H[Query engine]
    H --> I[context / why / impact / search]
    G --> J[Verify gate]
    J --> K[Hook engine]
    K --> L[Agent context and Stop gate]
    L --> M[CI merge gate]

Markers are the authoring notation; the graph is the product. Paths, line numbers, commit SHAs, and test results are derived — never written into markers — so trace identity survives refactors and evidence can never silently go stale.

Capabilities

Area What TraceLayer provides
Protocol One-line versioned trace:v1 grammar, typed semantic edges, stable IDs, deterministic type inference, generated schema docs
Indexing Full and changed-scope indexing, Markdown/YAML artifact extraction, fence-aware marker scanning, honest file-level degradation for unsupported languages
Symbols Tree-sitter attachment for Python, TypeScript, JavaScript, Go, Rust, and Java — markers attach to symbols, never line numbers
Graph SQLite materialized index with declared, structural (contains), and observed (executed) provenance; FTS5 search; bounded traversal
Provenance Git-derived first-seen/last-modified history, rename tracking, changed-line ranges, dirty-tree status — no commit IDs in source
Staleness Requirement/implementation fingerprints, upstream-change propagation, review states, historical evidence preservation
Policy Four profiles (minimal/standard/strict/safety-critical) across five lifecycles, scoped expiring waivers, deterministic TL-rule registry
Query UX context, why, impact, search, graph (tree/mermaid/DOT/JSON/JSONL), status, doctor, report pr
Hooks Session start, prompt context, pre-mutation block-once guard, post-mutation guidance, batch summary, fail-closed Stop gate
Evidence JUnit/Cobertura/normalized ingestion, revision binding, L0–L3 proof levels, per-test Python coverage adapter
Migration CodeOps scan/plan/apply with deterministic classification, Scry detection, doctor diagnostics with rename suggestions
Audit Bounded deterministic audit packages for an independent semantic reviewer — no LLM required for the engine itself

Quick start

Install

From the repository (no publish step needed):

uv tool install git+https://github.com/carterlasalle/tracelayer.git
trace --help

Or install from a local checkout: uv tool install .. The wheel is verified against a clean venv with uv build; a PyPI publish is the planned next step.

The first time you run trace outside a configured repository it prints next steps: trace init to enable traceability in the current repo, or trace install to install the skill and hooks into your agent harnesses globally. Set TRACE_NO_HINT=1 to silence that message (e.g. in CI).

Publishing

tracelayer is published to PyPI on version tags via trusted publishing (no tokens stored in CI). Publish a release with:

git tag v0.1.0 && git push origin v0.1.0

Manual publish from a checkout: uv build && uv publish. See .github/workflows/release.yml for the one-time PyPI trusted-publisher setup.

Prerequisites

  • Python 3.12+
  • uv (dependency management is uv-only; no pip)
uv sync
uv run trace --help

Trace an existing repository:

uv run trace init --root <repo>          # writes .trace/trace.toml + policy.toml
uv run trace index --root <repo> --all
uv run trace verify --root <repo> --all
uv run trace context --root <repo> <trace-id>

Run the full development baseline:

uv run pytest
uv run ruff check .
uv run trace docs generate --check

Architecture

TraceLayer is a single Python package with deliberately narrow module boundaries:

src/tracelayer/
  cli.py                   Typer CLI; business logic lives in modules
  engine.py                Indexing pipeline, verify, staleness, TraceRepository API
  config.py                trace.toml / policy.toml models and loading
  diagnostics.py           TL-rule registry; every failure carries remediation
  protocol/                Marker grammar, parser, ID rules, ontology, generated schema
  discovery/               File enumeration, ignore logic, monorepo scopes
  artifacts/               Markdown, YAML, and generic file-level extraction
  symbols/                 Tree-sitter parsers and marker-to-symbol attachment
  graph/                   Node/edge models, SQLite store, migrations, traversal, fingerprints
  git/                     Provenance, history, diff-range mapping (argv-array subprocess only)
  evidence/                JUnit, Cobertura, normalized JSON, freshness, proof levels
  policy/                  Profiles, lifecycle, waivers, deterministic rule functions
  query/                   context, why, impact, search
  hooks/                   Event handlers and file-backed session state
  audit/                   Bounded semantic-audit packages and external auditor adapter
  migration/               CodeOps and Scry importers

Every module is independently testable; the CLI is a thin shell over the engine.

Safety model

TraceLayer sits in the coding-agent control loop, so correctness is fail-closed by construction:

  • Declared claims are never displayed as proven: a test -> exercises -> implementation claim stays unproven until observed execution evidence exists (proof levels L0–L3).
  • Derived facts cannot be declared: paths, SHAs, test results, and structural/observed edges are rejected in markers.
  • Ambiguity is a diagnostic, never a silent guess: detached markers, unresolved targets, and duplicate IDs are deterministic TL failures with remediation.
  • Staleness preserves history: changing a requirement marks downstream review-required; it never deletes evidence.
  • Repository text is untrusted data: hooks inject bounded, sanitized summaries; subprocess calls use argv arrays; no shell=True.
  • Policy can weaken only deliberately: enforcement-file changes surface as TL063 warnings; waivers are scoped, owned, and expiring.
  • CI and the Stop gate run the same engine as the CLI — there is no separate enforcement code path.

Documentation

Document Purpose
Concepts Three truths, the trace graph, stable IDs, staleness
Marker protocol Generated normative trace:v1 syntax and placement rules
Relationships Generated semantic/structural/observed edge semantics
Policy Profiles, lifecycles, waivers, and the TL-rule catalog
Hooks Event model, block-once semantics, injection safety
Evidence JUnit/Cobertura ingestion and proof levels L0–L3
Migration CodeOps scan/plan/apply workflow
Security Threat model and mitigations
Large repositories Incremental indexing, monorepo scopes, performance targets
Architecture decisions ADR-0001 through ADR-0008

Installing the agent skill

The canonical skill (canonical layout: SKILL.md + README.md + references/) lives in skills/traceability/ and is bundled with the installed package. Install it with trace install:

trace install --list                     # detect agents and install state
trace install --agent claude-code        # project scope (.claude/skills)
trace install --agent claude-code --global --yes   # ~/.claude/skills
trace install --yes                      # all detected agents, non-interactive

Hooks are merged for claude-code (.claude/settings.json) and codex (.codex/hooks.json) in project scope; other agents get the skill only — see adapters/<harness>/README.md for their hook setup. The same skill is installable through the skills.sh ecosystem:

npx skills add carterlasalle/tracelayer --agent claude-code

For existing repositories, trace init --skill copies the skill into .agents/skills/traceability/ directly. The same folder is ready for skill registries (e.g. skills.sh, anthropics/skills) — it follows the standard layout and links references directly from SKILL.md.

Contributing

TraceLayer uses protected, squash-only pull requests with required checks. Read CONTRIBUTING.md before making changes. Run uv run trace docs generate --check when editing protocol documentation and trace verify --changed before proposing a merge — this repository traces itself.

License

Apache License 2.0 — see LICENSE.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tracelayer-0.1.0.tar.gz (226.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tracelayer-0.1.0-py3-none-any.whl (163.3 kB view details)

Uploaded Python 3

File details

Details for the file tracelayer-0.1.0.tar.gz.

File metadata

  • Download URL: tracelayer-0.1.0.tar.gz
  • Upload date:
  • Size: 226.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for tracelayer-0.1.0.tar.gz
Algorithm Hash digest
SHA256 32a3c00bbf9dbb1720dddc332f40e770fb10d06c1c6ea5ec1481de6b0dc9c546
MD5 f277f45067cded474bcf7754a478694f
BLAKE2b-256 ff7bfea0cf3ccf3e0f0662c22ce4fc58652b7df084d1b3d8ed9059755f00bda7

See more details on using hashes here.

Provenance

The following attestation bundles were made for tracelayer-0.1.0.tar.gz:

Publisher: release.yml on carterlasalle/tracelayer

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file tracelayer-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: tracelayer-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 163.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for tracelayer-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 89a2456f12227c92fdac8f1ba87c1ed7b8fbd197f3e6355008e0ab03c6c63578
MD5 78eb2661c487536f64d068d77171f1e2
BLAKE2b-256 344b76c34dee85abd9ec38da2f8e9b32099ba412fe4c485859bc1d73014f4ca8

See more details on using hashes here.

Provenance

The following attestation bundles were made for tracelayer-0.1.0-py3-none-any.whl:

Publisher: release.yml on carterlasalle/tracelayer

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

0.2.38

2 files

0.2.37

2 files

0.2.36

2 files

0.2.35

2 files

0.2.34

2 files

0.2.33

2 files

0.2.32

2 files

0.2.31

2 files

0.2.30

2 files

0.2.29

2 files

0.2.28

2 files

0.2.27

2 files

0.2.26

2 files

0.2.25

2 files

0.2.24

2 files

0.2.23

2 files

0.2.22

2 files

0.2.21

2 files

0.2.20

2 files

0.2.19

2 files

0.2.18

2 files

0.2.17

2 files

0.2.16

2 files

0.2.15

2 files

0.2.14

2 files

0.2.13

2 files

0.2.12

2 files

0.2.11

2 files

0.2.10

2 files

0.2.9

2 files

0.2.8

2 files

0.2.7

2 files

0.2.6

2 files

0.2.5

2 files

0.2.4

2 files

0.2.3

2 files

0.2.2

2 files

0.2.1

2 files

0.2.0

2 files

0.1.16

2 files

0.1.15

2 files

0.1.14

2 files

0.1.13

2 files

0.1.12

2 files

0.1.11

2 files

0.1.10

2 files

0.1.9

2 files

0.1.8

2 files

0.1.7

2 files

0.1.6

2 files

0.1.5

2 files

0.1.4

2 files

0.1.3

2 files

0.1.2

2 files

0.1.1

2 files

This release

0.1.0 This release

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page