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

chalkline-0.1.0.tar.gz (4.0 kB view details)

Uploaded Source

Built Distribution

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

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

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for chalkline-0.1.0.tar.gz
Algorithm Hash digest
SHA256 0e3ef9f0d029bca7d54f9304a336587556e0545f1cb8ab811b9df06da284fd00
MD5 e3d43af7f856e1cc20dd79fc27f2e6ba
BLAKE2b-256 f304b9d5392ad33071456af4957729ee2c592544fb1c6324094071a235778f25

See more details on using hashes here.

File details

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

File metadata

  • Download URL: chalkline-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 chalkline-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e4bdba6b7639aa1a5d9cafaff7b62a9226fdd3bfe026093e30f901faaffe2b1b
MD5 69f0ed908c28440b5ab24a6c6346064e
BLAKE2b-256 1d6710709309370ab92202e64a022df3f0f8bb142b56b6cc0c343239a3ada695

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