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

inscript-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.

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: inscript-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 inscript-0.1.0.tar.gz
Algorithm Hash digest
SHA256 2da1366363735aa19b5bc78f06d2728f5f120fccf8a3705048d4e1c62474f7a2
MD5 2c14e7b9f9661c6bd9d105f2c2abb579
BLAKE2b-256 4ecb141b5fdd31275c4ef229f475b789e80892c792feba8a2cee86a8e0a779cc

See more details on using hashes here.

File details

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

File metadata

  • Download URL: inscript-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 inscript-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fe4c123ce8b2d217e335af17ab2642f1a8276f00ffb358d115b31562b51faada
MD5 03310d170584960781a24ac06535a688
BLAKE2b-256 6caad1bbdbeb4b9a1e946883681ba6520c4eef33d5d00255ff03d1161ee458cd

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