Skip to main content

trace

Universal agent context tracking.

When an AI agent works on code, trace records which project it's in. Any tool — MCP servers, hooks, scripts — can read ~/.trace/active_project to know the current context.

Install

pip install trace

How it works

A Claude Code hook fires on every file operation (Read, Edit, Write). It extracts the git root from the file path and writes it to ~/.trace/active_project. That's it.

Any tool can read this file. No coordination needed.

Python API

from trace_pkg import active_project

project = active_project()  # Path("/Users/you/your-project") or None

CLI

trace          # print active project
trace set .    # manually set active project

Claude Code setup

Add to ~/.claude/settings.json:

{
  "hooks": {
    "PostToolUse": [
      {
        "matcher": "Read|Edit|Write|Glob|Grep",
        "hooks": [
          {
            "type": "command",
            "command": "trace-hook",
            "async": true
          }
        ]
      }
    ]
  }
}

Why

MCP servers need to know what project the agent is working in. Without trace, each server has to guess from cwd, env vars, or explicit configuration. With trace, there's one source of truth that updates automatically.

Metadata

Release files for afterlight 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for afterlight 0.1.0
File Size Uploaded Provenance
afterlight-0.1.0.tar.gz 4.1 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for afterlight 0.1.0
File Interpreter ABI Platform
afterlight-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 9.0 kB

Release files / afterlight-0.1.0.tar.gz

Download URL afterlight-0.1.0.tar.gz
Size 4.1 kB
Tags Source
SHA-256 checksum
How to use checksums
9218b650eb06a8f838d7024621a22a00a691bcf337b9ca518173d4e2a1963d2c
BLAKE2b-256 checksum
How to use checksums
c4fc068711d8d77f75e0f7608d2d906d9ff1e9e6b2c39f4ff67c0ae9236fdd83
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.13

Release files / afterlight-0.1.0-py3-none-any.whl

Download URL afterlight-0.1.0-py3-none-any.whl
Size 4.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
76b418b0a485845acd3a02c6c7cbe783a9195bc47b397e50f99bdd43a49533bc
BLAKE2b-256 checksum
How to use checksums
1997035c50d75784fcaddfa9bffe6d8bc5344b7aa15ccee99bb346a9249805b9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.13

Security for afterlight 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page