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 trajectory-ai

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

trajectory_ai-0.2.0.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.

trajectory_ai-0.2.0-py3-none-any.whl (17.6 kB view details)

Uploaded Python 3

File details

Details for the file trajectory_ai-0.2.0.tar.gz.

File metadata

  • Download URL: trajectory_ai-0.2.0.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 trajectory_ai-0.2.0.tar.gz
Algorithm Hash digest
SHA256 3b3c8c4d43a42551d6e55f4413f8b4e09adffc543425fdae71793dad417cb349
MD5 c26a6637e8ef6fcb9db1c4b42abdeb9f
BLAKE2b-256 d358a2eb63e209ee135a703aea952c196cf588c522e899664fc77b2f70a79757

See more details on using hashes here.

Provenance

The following attestation bundles were made for trajectory_ai-0.2.0.tar.gz:

Publisher: publish.yml on nishantmodak/trajectory-ai

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

File details

Details for the file trajectory_ai-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: trajectory_ai-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 17.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for trajectory_ai-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c76a9461c4783e7886eb4adc683644caf4a399fc279879c213fbd550b842bcd2
MD5 3578d671882b6e713ff644abe7cf3495
BLAKE2b-256 16060267d47b404cacf4ff38e13da756b3322473bc8ed5c73fad1d87ecdee7b6

See more details on using hashes here.

Provenance

The following attestation bundles were made for trajectory_ai-0.2.0-py3-none-any.whl:

Publisher: publish.yml on nishantmodak/trajectory-ai

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