Skip to main content

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

Metadata

Release files for code-trajectory 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for code-trajectory 0.1.1
File Size Uploaded Provenance
code_trajectory-0.1.1.tar.gz 14.7 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for code-trajectory 0.1.1
File Interpreter ABI Platform
code_trajectory-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 32.3 kB

Release files / code_trajectory-0.1.1.tar.gz

Download URL code_trajectory-0.1.1.tar.gz
Size 14.7 kB
Tags Source
SHA-256 checksum
How to use checksums
f415d22397551cba3a02ad099d1cbde689d83b8691351b35ba13c08a6ac47335
BLAKE2b-256 checksum
How to use checksums
5e3749241907d49d50d63fee0b5d9a108225c58b934716166fab2ee062f632ee
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jan 12, 2026.

Transparency log

Release files / code_trajectory-0.1.1-py3-none-any.whl

Download URL code_trajectory-0.1.1-py3-none-any.whl
Size 17.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
392e173a7f9c5ac4a7a9424b3971b0faa70aec1b72a0080569f0c1f9edf17892
BLAKE2b-256 checksum
How to use checksums
d41912d233d63dc1079e454f9fcaabed3eccf7ae9842d176be92a680106d86a4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jan 12, 2026.

Transparency log

Security for code-trajectory 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for code_trajectory-0.1.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jan 12, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page