Skip to main content

Generate decision logs from Claude Code sessions

Project description

trajectory

PyPI version License: MIT

Capture the why behind AI-generated code.

When you use Claude Code to write code, trajectory generates a decision log — what was decided, what was rejected, what was assumed. Attach it to your PR so reviewers see the reasoning, not just the diff.

Install

pip install code-trajectory

Requires ANTHROPIC_API_KEY environment variable.

Usage

cd your-project
trajectory gen

Creates trajectory.md:

# feat/add-user-auth

> Implement JWT authentication for the API

**Decisions:**
- Use RS256 for token signing
- Store refresh tokens in httpOnly cookies
  ... +3 more (--audit)

---
_Session: a1b2c3d4_

Commands

trajectory gen                 # generate trajectory.md
trajectory gen --copy          # generate + copy to clipboard
trajectory gen --flow          # ASCII flow diagram
trajectory gen --audit         # full provenance details
trajectory gen -s 17c072d8     # use specific session
trajectory list                # show available sessions

Flow Diagram

trajectory gen --flow
╔══ feat/add-user-auth ══╗

  ┌─ INTENT ────────────────────────────┐
  │ Add JWT auth to the API             │
  └─────────────────────────────────────┘
                    │
                    ▼
  ┌─ DIRECTIVE ─────────────────────────┐
  │ Use RS256 for token signing         │
  └─────────────────────────────────────┘
                    │
                    ▼
  ┌─ IMPLEMENT ─────────────────────────┐
  │ Add refresh token rotation          │
  └─────────────────────────────────────┘
                    │
                    ▼
  ┌─ OUTPUT ────────────────────────────┐
  │ jwt.ts (new)                        │
  │ auth.ts (3 edits)                   │
  └─────────────────────────────────────┘

  ╳─ REJECTED ──────────────────────────╳
  ╳ Session-based auth with Redis       ╳
  ╳─────────────────────────────────────╳

╚══ Session: a1b2c3d4 ══╝

Full Provenance (--audit)

**Decisions:**
- Use RS256 for token signing
  Better security for production environments
  `[chosen]` _Selected from: RS256 / HS256 / ES256_

**Rejected:**
- Session-based auth with Redis
  _More infrastructure overhead_

**Assumptions:**
- API consumed by first-party clients only `[inferred]`

**Deferred:**
- Rate limiting _Explicitly marked for v2_
Label Meaning
[explicit] User directly stated
[chosen] User selected from options
[inferred] Deduced from context

How It Works

  1. Claude Code saves session logs to ~/.claude/projects/
  2. Trajectory reads the JSONL (conversation, tool calls, file edits)
  3. Uses Claude API to extract structured decisions
  4. Generates clean markdown for your PR

Requirements

  • Python 3.9+
  • Claude Code
  • ANTHROPIC_API_KEY

License

MIT

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

code_trajectory-0.1.1.tar.gz (14.7 kB view details)

Uploaded Source

Built Distribution

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

code_trajectory-0.1.1-py3-none-any.whl (17.6 kB view details)

Uploaded Python 3

File details

Details for the file code_trajectory-0.1.1.tar.gz.

File metadata

  • Download URL: code_trajectory-0.1.1.tar.gz
  • Upload date:
  • Size: 14.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for code_trajectory-0.1.1.tar.gz
Algorithm Hash digest
SHA256 f415d22397551cba3a02ad099d1cbde689d83b8691351b35ba13c08a6ac47335
MD5 93c14fc5a0a3f486352fd93266a9f17e
BLAKE2b-256 5e3749241907d49d50d63fee0b5d9a108225c58b934716166fab2ee062f632ee

See more details on using hashes here.

Provenance

The following attestation bundles were made for code_trajectory-0.1.1.tar.gz:

Publisher: publish.yml on nishantmodak/trajectory

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

File details

Details for the file code_trajectory-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for code_trajectory-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 392e173a7f9c5ac4a7a9424b3971b0faa70aec1b72a0080569f0c1f9edf17892
MD5 37491812c67a9a9b1f8b0b5c23f0947d
BLAKE2b-256 d41912d233d63dc1079e454f9fcaabed3eccf7ae9842d176be92a680106d86a4

See more details on using hashes here.

Provenance

The following attestation bundles were made for code_trajectory-0.1.1-py3-none-any.whl:

Publisher: publish.yml on nishantmodak/trajectory

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

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