Skip to main content

Universal agent context tracking. Know what codebase the agent is working in.

Project description

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.

Project details


Download files

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

Source Distribution

afterlight-0.1.0.tar.gz (4.1 kB view details)

Uploaded Source

Built Distribution

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

afterlight-0.1.0-py3-none-any.whl (4.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: afterlight-0.1.0.tar.gz
  • Upload date:
  • Size: 4.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for afterlight-0.1.0.tar.gz
Algorithm Hash digest
SHA256 9218b650eb06a8f838d7024621a22a00a691bcf337b9ca518173d4e2a1963d2c
MD5 691984a87280003412ff6606f9ccafb9
BLAKE2b-256 c4fc068711d8d77f75e0f7608d2d906d9ff1e9e6b2c39f4ff67c0ae9236fdd83

See more details on using hashes here.

File details

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

File metadata

  • Download URL: afterlight-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for afterlight-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 76b418b0a485845acd3a02c6c7cbe783a9195bc47b397e50f99bdd43a49533bc
MD5 962195321c72b950bef78b036d97adc7
BLAKE2b-256 1997035c50d75784fcaddfa9bffe6d8bc5344b7aa15ccee99bb346a9249805b9

See more details on using hashes here.

Supported by

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