afterpaths 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. afterpaths-0.1.0/.afterpaths/.gitignore +1 -0
  2. afterpaths-0.1.0/.afterpaths/meta.json +29 -0
  3. afterpaths-0.1.0/.afterpaths/summaries/78a3e6cb-9e11-47c5-b4a7-6abc84ffe802.md +34 -0
  4. afterpaths-0.1.0/.afterpaths/summaries/7faf6980-c5cf-41b4-959e-2f889615c9e2.md +52 -0
  5. afterpaths-0.1.0/.env.example +33 -0
  6. afterpaths-0.1.0/.gitignore +72 -0
  7. afterpaths-0.1.0/IMPLEMENTATION.md +676 -0
  8. afterpaths-0.1.0/PKG-INFO +184 -0
  9. afterpaths-0.1.0/README.md +167 -0
  10. afterpaths-0.1.0/afterpaths/__init__.py +3 -0
  11. afterpaths-0.1.0/afterpaths/analytics.py +598 -0
  12. afterpaths-0.1.0/afterpaths/cache.py +71 -0
  13. afterpaths-0.1.0/afterpaths/cli.py +916 -0
  14. afterpaths-0.1.0/afterpaths/config.py +89 -0
  15. afterpaths-0.1.0/afterpaths/daily_stats.py +429 -0
  16. afterpaths-0.1.0/afterpaths/exporters/__init__.py +23 -0
  17. afterpaths-0.1.0/afterpaths/exporters/base.py +78 -0
  18. afterpaths-0.1.0/afterpaths/exporters/claude.py +142 -0
  19. afterpaths-0.1.0/afterpaths/exporters/cursor.py +165 -0
  20. afterpaths-0.1.0/afterpaths/file_tracking.py +251 -0
  21. afterpaths-0.1.0/afterpaths/git_refs.py +207 -0
  22. afterpaths-0.1.0/afterpaths/licensing.py +132 -0
  23. afterpaths-0.1.0/afterpaths/llm.py +152 -0
  24. afterpaths-0.1.0/afterpaths/rules.py +455 -0
  25. afterpaths-0.1.0/afterpaths/sources/__init__.py +17 -0
  26. afterpaths-0.1.0/afterpaths/sources/base.py +126 -0
  27. afterpaths-0.1.0/afterpaths/sources/claude_code.py +263 -0
  28. afterpaths-0.1.0/afterpaths/sources/codex.py +355 -0
  29. afterpaths-0.1.0/afterpaths/sources/cursor.py +248 -0
  30. afterpaths-0.1.0/afterpaths/stack.py +250 -0
  31. afterpaths-0.1.0/afterpaths/storage.py +81 -0
  32. afterpaths-0.1.0/afterpaths/summarize.py +397 -0
  33. afterpaths-0.1.0/docs/analytics.md +156 -0
  34. afterpaths-0.1.0/docs/commands.md +624 -0
  35. afterpaths-0.1.0/pyproject.toml +31 -0
@@ -0,0 +1 @@
1
+ *
@@ -0,0 +1,29 @@
1
+ {
2
+ "sessions": [
3
+ {
4
+ "session_id": "7faf6980-c5cf-41b4-959e-2f889615c9e2",
5
+ "source": "claude_code",
6
+ "source_path": "/Users/burnssa/.claude/projects/-Users-burnssa-Code-afterpaths/7faf6980-c5cf-41b4-959e-2f889615c9e2.jsonl",
7
+ "summary_path": "/Users/burnssa/Code/afterpaths/.afterpaths/summaries/7faf6980-c5cf-41b4-959e-2f889615c9e2.md",
8
+ "git_refs": [],
9
+ "created_at": "2026-01-10T15:32:29.232741",
10
+ "updated_at": "2026-01-10T16:01:21.047440"
11
+ },
12
+ {
13
+ "session_id": "78a3e6cb-9e11-47c5-b4a7-6abc84ffe802",
14
+ "source": "claude_code",
15
+ "source_path": "/Users/burnssa/.claude/projects/-Users-burnssa-Code-afterpaths/78a3e6cb-9e11-47c5-b4a7-6abc84ffe802.jsonl",
16
+ "summary_path": "/Users/burnssa/Code/afterpaths/.afterpaths/summaries/78a3e6cb-9e11-47c5-b4a7-6abc84ffe802.md",
17
+ "git_refs": [],
18
+ "created_at": "2026-01-14T20:16:08.674304"
19
+ }
20
+ ],
21
+ "version": 1,
22
+ "distill": {
23
+ "sessions_included": [
24
+ "7faf6980-c5cf-41b4-959e-2f889615c9e2"
25
+ ],
26
+ "version": 1,
27
+ "last_run": "2026-01-10T16:21:53.965064"
28
+ }
29
+ }
@@ -0,0 +1,34 @@
1
+ # Removing Paywall and Adding Cursor Support to Afterpaths
2
+
3
+ **Date:** 2026-01-14 | **Duration:** 6h 38m
4
+ **Files:** README.md, cli.py, licensing.py, base.py, claude_code.py, cursor.py
5
+
6
+ ## Summary
7
+ Removed the Pro licensing paywall from the rules extraction feature, making it free for all users. Added a new Cursor IDE session adapter to read chat history from SQLite databases. Fixed several bugs in session filtering and improved the CLI output to show summarization status.
8
+
9
+ ## Discoveries
10
+ - **Claude Code auto-deletes sessions after 30 days by default** - Users can prevent this by setting `"cleanupPeriodDays": 99999` in `~/.claude/settings.json`. This is a key value prop for afterpaths.
11
+ - **Claude Code automatically loads all `.md` files from `.claude/rules/`** - No code needed to inject rules; just write files to that directory and they're included in context at session start, same priority as `CLAUDE.md`.
12
+ - **Cursor stores chat history in SQLite databases** - Located at `~/Library/Application Support/Cursor/User/workspaceStorage/*/state.vscdb`. The chat data is in tables like `ItemTable` with keys containing "aiChat" or "composer" (Cursor 0.43+).
13
+ - **The `get_sessions_for_cwd()` function only queried Claude Code** - It was hardcoded to use `ClaudeCodeAdapter` instead of iterating through all registered adapters, so Cursor sessions were invisible without `--all`.
14
+
15
+ ## Dead Ends
16
+ - **Substring matching for project filtering** - The original filter checked `if project_filter in project_name`, which caused `/Users/burnssa/Code/superjective` to match both `superjective` and `superjective-extension` directories. Changed to exact path matching with `==`.
17
+
18
+ ## Decisions
19
+ - **Made rules extraction free instead of Pro-only** - User wants to understand usage patterns before deciding what to monetize. Kept the licensing infrastructure for a future "Vault" feature.
20
+ - **Used exact path matching for project filtering** - Substring matching caused cross-project pollution. Exact match is the expected behavior when scoping to a directory.
21
+ - **Removed `activate` command entirely** - No current paid features, so the command was confusing. The `licensing.py` file remains for future use.
22
+
23
+ ## Gotchas & Warnings
24
+ - **Session type filtering hides most sessions by default** - `afterpaths log` only shows "main" sessions, not "agent" sessions (spawned by Task tool). A project might have 17 total sessions but only 4 main ones. Use `--type=all` to see everything.
25
+ - **Summary titles come from two sources** - Afterpaths summaries have a `# heading` that gets extracted. Claude Code also stores its own auto-generated summary in the JSONL. The CLI now shows afterpaths summary if available, otherwise falls back to Claude's.
26
+ - **Cursor workspace folders are stored as JSON in SQLite** - The `folder` key in `state.vscdb` contains a JSON string with a `path` field, not a direct path string.
27
+
28
+ ## Open Questions
29
+ - **What triggers Claude Code's session cleanup?** - Is it strictly 30 days from last modification, or are there other criteria? Some users report unexpected deletions.
30
+ - **How should Cursor Composer chats be differentiated from regular chats?** - The adapter finds both but they may have different structures in Cursor 0.43+.
31
+ - **Should afterpaths proactively warn users about the 30-day retention?** - Could add a check on first run to suggest the settings.json change.
32
+
33
+ ---
34
+ *Generated by anthropic/claude-opus-4-5-20251101 | Tokens: 11620 in, 862 out*
@@ -0,0 +1,52 @@
1
+ # Building Afterpaths: AI Session Analysis Tool with Git Integration
2
+
3
+ **Date:** 2026-01-10 | **Duration:** 2h 4m
4
+ **Files:** 13 files modified
5
+ **Git refs:** None detected
6
+
7
+ ## Summary
8
+ Built "Afterpaths" - a tool to extract, analyze and summarize AI coding sessions from Claude Code. Started with session listing/viewing, added git ref extraction and commit tracing via diff matching, then implemented LLM-powered summarization with provider-agnostic architecture. Extended with file modification tracking, repo-scoped git ref filtering, and protective flags for summary management.
9
+
10
+ ## Discoveries
11
+ - **Claude Code session format differs from spec**: Directory names use hyphen-separated paths (`-Users-burnssa-Code-afterpaths`), not base64 encoding as documented
12
+ - **Tool results are embedded**: Tool responses appear as `tool_result` content blocks within `user` entries, not as separate entry types
13
+ - **Agent vs main sessions pattern**: Sessions starting with `agent-` are sub-processes spawned by Task tool, typically 1-2KB vs main sessions of 100KB+
14
+ - **Time filtering complexity**: Session file modification time != session activity time - needed 1-day buffer after commit to catch active sessions
15
+ - **Path decoding ambiguity**: Hyphens in directory names make decoding tricky - added fallback verification against actual filesystem paths
16
+ - **Caching provides 4x speedup**: File modification extraction went from 0.277s to 0.065s with JSON caching
17
+ - **Git ref false positives from tool output**: Command outputs like `afterpaths link` results were being parsed as legitimate git refs - needed to filter against actual repo existence
18
+ - **Sessions can have built-in summaries**: Claude Code itself generates `summary` fields for some sessions, stored directly in the JSONL file
19
+
20
+ ## Dead Ends
21
+ - **Base64 path decoding approach** - Original spec assumed base64 encoding, but actual format uses simple hyphen replacement (discovered after implementing decoder)
22
+ - **30-day commit search window** - Too broad, most commits happen within days of session, reduced to 7 days default
23
+ - **Exact content matching for commits** - Initially planned fuzzy diff matching, but file-path-based matching proved sufficient and much simpler
24
+ - **Git ref extraction from all text** - Initially parsed all session content for refs, but this captured false positives from discussions about other repos and from afterpaths' own output
25
+
26
+ ## Decisions
27
+ - **Session type filtering by default** - Show only main sessions in `log` command since agent sessions are usually noise, but allow `--type=all` for full view
28
+ - **Provider-agnostic LLM architecture** - Built abstraction layer supporting Anthropic, OpenAI, and OpenAI-compatible APIs rather than hardcoding Anthropic
29
+ - **Caching at file-activity level** - Cache extracted file modifications per session rather than raw parsing, provides good speedup without excessive storage
30
+ - **7-day commit trace window** - Reasonable default covering weekend delays while avoiding false positives from old sessions
31
+ - **Repo-scoped git ref filtering** - Filter detected refs against current git repo using `git branch -a` and `git rev-parse --verify` to eliminate false positives from other projects
32
+ - **Summary overwrite protection** - Require `--force` to overwrite existing summaries, `--update` to refine them with LLM
33
+ - **Extract refs from git commands only** - Changed from parsing all text to only extracting from actual Bash tool inputs containing git commands, reducing false positives
34
+
35
+ ## Gotchas & Warnings
36
+ - **Session numbering consistency** - `show` command must use same type filtering as `log` so session numbers match between commands
37
+ - **Git ref false positives** - Documentation text can contain words like "branch" and "commit" - needed context-aware regex filtering
38
+ - **Time zone handling** - Commit times and session times may be in different zones, using 1-day buffer to handle edge cases
39
+ - **Large session files** - Some sessions are 30MB+ (especially hex-line-assignment), parsing can be slow without caching
40
+ - **Cross-repo git ref pollution** - Sessions discussing multiple repos can show refs from other projects unless filtered by current repo
41
+ - **Model version defaults** - Initial config used `claude-sonnet-4-20250514` instead of correct `claude-sonnet-4-5-20250929`; Opus 4.5 is `claude-opus-4-5-20251101`
42
+ - **Renamed directories** - Sessions may reference paths that no longer exist (e.g., `hex-line-assignment` renamed to `hex_line_assignment`) - fallback decoding handles this gracefully
43
+
44
+ ## Open Questions
45
+ - **Content-based commit matching** - Current approach matches by files modified, but doesn't verify actual content similarity - would fuzzy diff matching catch more cases?
46
+ - **Session activity time extraction** - Could parse session timestamps more precisely rather than using file modification time?
47
+ - **Cross-session linking** - Sessions sometimes reference other sessions or continue work - worth extracting these connections?
48
+ - **Summary quality evaluation** - How to measure if generated summaries are actually useful for future work?
49
+ - **Git ref scope balance** - Current repo-only filtering prevents false positives but might miss legitimate cross-repo references
50
+
51
+ ---
52
+ *Generated by anthropic/claude-opus-4-5-20251101 | Tokens: 27721 in, 1196 out*
@@ -0,0 +1,33 @@
1
+ # Afterpaths Configuration
2
+ # Copy this file to .env and fill in your values
3
+
4
+ # =============================================================================
5
+ # LLM Provider Configuration
6
+ # =============================================================================
7
+
8
+ # Provider: anthropic, openai, or openai-compatible
9
+ AFTERPATHS_LLM_PROVIDER=anthropic
10
+
11
+ # API Key for your chosen provider
12
+ ANTHROPIC_API_KEY=sk-ant-...
13
+ # OPENAI_API_KEY=sk-...
14
+
15
+ # Model to use for summarization
16
+ # Anthropic: claude-sonnet-4-5-20250929, claude-opus-4-5-20251101, claude-haiku-3-5-20241022
17
+ # OpenAI: gpt-4o, gpt-4o-mini, gpt-4-turbo
18
+ AFTERPATHS_MODEL=claude-sonnet-4-5-20250929
19
+
20
+ # =============================================================================
21
+ # OpenAI-Compatible API (for local models, Azure, etc.)
22
+ # =============================================================================
23
+
24
+ # Base URL for OpenAI-compatible APIs (e.g., local Ollama, LM Studio, Azure)
25
+ # OPENAI_API_BASE=http://localhost:11434/v1
26
+ # OPENAI_API_KEY=not-needed-for-local
27
+
28
+ # =============================================================================
29
+ # Optional Settings
30
+ # =============================================================================
31
+
32
+ # Max tokens for summary generation (default: 3000)
33
+ # AFTERPATHS_MAX_TOKENS=3000
@@ -0,0 +1,72 @@
1
+ # Environment and secrets
2
+ .env
3
+ .env.local
4
+ .env.*.local
5
+ *.pem
6
+ *.key
7
+ secrets/
8
+
9
+ # macOS
10
+ .DS_Store
11
+ .AppleDouble
12
+ .LSOverride
13
+ ._*
14
+
15
+ # Claude Code
16
+ .claude/
17
+
18
+ # Python
19
+ __pycache__/
20
+ *.py[cod]
21
+ *$py.class
22
+ *.so
23
+ .Python
24
+ build/
25
+ develop-eggs/
26
+ dist/
27
+ downloads/
28
+ eggs/
29
+ .eggs/
30
+ lib/
31
+ lib64/
32
+ parts/
33
+ sdist/
34
+ var/
35
+ wheels/
36
+ *.egg-info/
37
+ .installed.cfg
38
+ *.egg
39
+
40
+ # Virtual environments
41
+ venv/
42
+ ENV/
43
+ env/
44
+ .venv/
45
+
46
+ # IDE and editors
47
+ .idea/
48
+ .vscode/
49
+ *.swp
50
+ *.swo
51
+ *~
52
+ .project
53
+ .pydevproject
54
+ .settings/
55
+
56
+ # Testing and coverage
57
+ .tox/
58
+ .nox/
59
+ .coverage
60
+ .coverage.*
61
+ htmlcov/
62
+ .pytest_cache/
63
+ .hypothesis/
64
+
65
+ # Logs
66
+ *.log
67
+ logs/
68
+
69
+ # Misc
70
+ .cache/
71
+ *.bak
72
+ *.tmp