agentsesh 0.4.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.
- agentsesh-0.4.0/PKG-INFO +232 -0
- agentsesh-0.4.0/README.md +208 -0
- agentsesh-0.4.0/agentsesh.egg-info/PKG-INFO +232 -0
- agentsesh-0.4.0/agentsesh.egg-info/SOURCES.txt +36 -0
- agentsesh-0.4.0/agentsesh.egg-info/dependency_links.txt +1 -0
- agentsesh-0.4.0/agentsesh.egg-info/entry_points.txt +4 -0
- agentsesh-0.4.0/agentsesh.egg-info/requires.txt +6 -0
- agentsesh-0.4.0/agentsesh.egg-info/top_level.txt +1 -0
- agentsesh-0.4.0/pyproject.toml +40 -0
- agentsesh-0.4.0/sesh/__init__.py +3 -0
- agentsesh-0.4.0/sesh/__main__.py +5 -0
- agentsesh-0.4.0/sesh/analyzers/__init__.py +1 -0
- agentsesh-0.4.0/sesh/analyzers/grader.py +147 -0
- agentsesh-0.4.0/sesh/analyzers/patterns.py +327 -0
- agentsesh-0.4.0/sesh/analyzers/trends.py +134 -0
- agentsesh-0.4.0/sesh/cli.py +420 -0
- agentsesh-0.4.0/sesh/config.py +145 -0
- agentsesh-0.4.0/sesh/db.py +400 -0
- agentsesh-0.4.0/sesh/formatters/__init__.py +1 -0
- agentsesh-0.4.0/sesh/formatters/handoff.py +148 -0
- agentsesh-0.4.0/sesh/formatters/json_out.py +47 -0
- agentsesh-0.4.0/sesh/formatters/report.py +216 -0
- agentsesh-0.4.0/sesh/mcp_server.py +354 -0
- agentsesh-0.4.0/sesh/parsers/__init__.py +52 -0
- agentsesh-0.4.0/sesh/parsers/base.py +118 -0
- agentsesh-0.4.0/sesh/parsers/claude_code.py +213 -0
- agentsesh-0.4.0/sesh/parsers/openai_codex.py +324 -0
- agentsesh-0.4.0/sesh/py.typed +0 -0
- agentsesh-0.4.0/sesh/watch.py +156 -0
- agentsesh-0.4.0/sesh/web/__init__.py +1 -0
- agentsesh-0.4.0/sesh/web/server.py +536 -0
- agentsesh-0.4.0/setup.cfg +4 -0
- agentsesh-0.4.0/tests/test_cli.py +158 -0
- agentsesh-0.4.0/tests/test_grader.py +113 -0
- agentsesh-0.4.0/tests/test_openai_parser.py +331 -0
- agentsesh-0.4.0/tests/test_parser.py +160 -0
- agentsesh-0.4.0/tests/test_patterns.py +258 -0
- agentsesh-0.4.0/tests/test_watch.py +216 -0
agentsesh-0.4.0/PKG-INFO
ADDED
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: agentsesh
|
|
3
|
+
Version: 0.4.0
|
|
4
|
+
Summary: Agent session intelligence — behavioral analysis, grading, and handoff for AI agent sessions
|
|
5
|
+
License: MIT
|
|
6
|
+
Project-URL: Homepage, https://agentsesh.com
|
|
7
|
+
Project-URL: Repository, https://github.com/ateeples/agentsesh
|
|
8
|
+
Classifier: Development Status :: 3 - Alpha
|
|
9
|
+
Classifier: Environment :: Console
|
|
10
|
+
Classifier: Intended Audience :: Developers
|
|
11
|
+
Classifier: Topic :: Software Development :: Quality Assurance
|
|
12
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
18
|
+
Requires-Python: >=3.10
|
|
19
|
+
Description-Content-Type: text/markdown
|
|
20
|
+
Provides-Extra: mcp
|
|
21
|
+
Requires-Dist: mcp>=1.0; extra == "mcp"
|
|
22
|
+
Provides-Extra: all
|
|
23
|
+
Requires-Dist: mcp>=1.0; extra == "all"
|
|
24
|
+
|
|
25
|
+
# sesh
|
|
26
|
+
|
|
27
|
+
Agent session intelligence. Behavioral analysis, grading, and self-improvement for AI coding agents.
|
|
28
|
+
|
|
29
|
+
sesh parses agent session transcripts, detects anti-patterns, grades sessions, and tracks trends over time. Built so agents can analyze themselves — and so humans can see what their agents are doing.
|
|
30
|
+
|
|
31
|
+
## Three interfaces, one engine
|
|
32
|
+
|
|
33
|
+
| Interface | For | How |
|
|
34
|
+
|-----------|-----|-----|
|
|
35
|
+
| **CLI** | Developers in the terminal | `sesh reflect`, `sesh report`, `sesh search` |
|
|
36
|
+
| **MCP Server** | Agents at runtime | Add to your MCP config, agent calls `sesh_reflect` |
|
|
37
|
+
| **Web Dashboard** | Humans who want observability | `sesh-web` → browser dashboard on localhost |
|
|
38
|
+
|
|
39
|
+
All three use the same analysis engine and database. Install once, use from anywhere.
|
|
40
|
+
|
|
41
|
+
## Install
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
pip install agentsesh
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Or from source:
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
git clone https://github.com/ateeples/agentsesh.git
|
|
51
|
+
cd agentsesh
|
|
52
|
+
pip install -e .
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Quick start
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
# Initialize in your project
|
|
59
|
+
sesh init
|
|
60
|
+
|
|
61
|
+
# Auto-discover and ingest all Claude Code sessions
|
|
62
|
+
sesh watch --once
|
|
63
|
+
|
|
64
|
+
# See your most recent session analysis
|
|
65
|
+
sesh reflect
|
|
66
|
+
|
|
67
|
+
# Cross-session trends
|
|
68
|
+
sesh report
|
|
69
|
+
|
|
70
|
+
# Search past sessions
|
|
71
|
+
sesh search "authentication bug"
|
|
72
|
+
|
|
73
|
+
# Keep ingesting new sessions in the background
|
|
74
|
+
sesh watch
|
|
75
|
+
|
|
76
|
+
# Launch the dashboard
|
|
77
|
+
sesh-web
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## MCP Server (agent-native)
|
|
81
|
+
|
|
82
|
+
Add sesh to your agent's MCP configuration so it can self-analyze at runtime.
|
|
83
|
+
|
|
84
|
+
**Claude Code** (`~/.claude/settings.json`):
|
|
85
|
+
|
|
86
|
+
```json
|
|
87
|
+
{
|
|
88
|
+
"mcpServers": {
|
|
89
|
+
"sesh": {
|
|
90
|
+
"command": "sesh-mcp",
|
|
91
|
+
"env": {
|
|
92
|
+
"SESH_DB": "/path/to/your/project/.sesh/sesh.db"
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
**Claude Desktop** (`claude_desktop_config.json`):
|
|
100
|
+
|
|
101
|
+
```json
|
|
102
|
+
{
|
|
103
|
+
"mcpServers": {
|
|
104
|
+
"sesh": {
|
|
105
|
+
"command": "sesh-mcp",
|
|
106
|
+
"env": {
|
|
107
|
+
"SESH_DB": "/path/to/your/project/.sesh/sesh.db"
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
Once configured, the agent has access to these tools:
|
|
115
|
+
|
|
116
|
+
| Tool | What it does |
|
|
117
|
+
|------|-------------|
|
|
118
|
+
| `sesh_reflect` | Full session analysis — grade, patterns, tool usage |
|
|
119
|
+
| `sesh_report` | Cross-session trends — improving, stable, or declining |
|
|
120
|
+
| `sesh_handoff` | Structured handoff doc for session continuity |
|
|
121
|
+
| `sesh_search` | Full-text search across all sessions |
|
|
122
|
+
| `sesh_list` | List recent sessions with grades |
|
|
123
|
+
| `sesh_stats` | Lifetime aggregate statistics |
|
|
124
|
+
| `sesh_log` | Ingest a new transcript |
|
|
125
|
+
| `sesh_sync` | Auto-discover and ingest new sessions |
|
|
126
|
+
| `sesh_patterns` | Detailed pattern breakdown for a session |
|
|
127
|
+
|
|
128
|
+
An agent can call `sesh_sync` then `sesh_reflect` at session start to auto-ingest new transcripts and review its last session, or `sesh_report` to see if it's been improving or repeating the same mistakes.
|
|
129
|
+
|
|
130
|
+
## Web Dashboard
|
|
131
|
+
|
|
132
|
+
```bash
|
|
133
|
+
sesh-web # http://127.0.0.1:7433
|
|
134
|
+
sesh-web --port 8080 # custom port
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
The dashboard shows:
|
|
138
|
+
- Session grades and score trends
|
|
139
|
+
- Grade distribution across all sessions
|
|
140
|
+
- Tool usage breakdown
|
|
141
|
+
- Recurring anti-patterns
|
|
142
|
+
- Full-text session search
|
|
143
|
+
|
|
144
|
+
Auto-refreshes every 30 seconds — leave it open while your agent works.
|
|
145
|
+
|
|
146
|
+
## What it detects
|
|
147
|
+
|
|
148
|
+
sesh runs 9 pattern detectors on every session:
|
|
149
|
+
|
|
150
|
+
| Pattern | What it catches |
|
|
151
|
+
|---------|----------------|
|
|
152
|
+
| `repeated_searches` | Same search query run multiple times |
|
|
153
|
+
| `write_without_read` | Editing a file that was never read |
|
|
154
|
+
| `error_rate` | Overall error percentage above threshold |
|
|
155
|
+
| `error_streak` | Consecutive errors (agent stuck in a loop) |
|
|
156
|
+
| `low_read_ratio` | Not enough reading relative to writing |
|
|
157
|
+
| `bash_overuse` | Using bash for cat/grep/find when dedicated tools exist |
|
|
158
|
+
| `write_then_read` | Writing before understanding (acted before reading) |
|
|
159
|
+
| `scattered_files` | Touching too many directories (unfocused session) |
|
|
160
|
+
| `missed_parallelism` | Sequential reads that could have been parallel |
|
|
161
|
+
|
|
162
|
+
## Grading
|
|
163
|
+
|
|
164
|
+
Sessions are scored 0–100 and graded A+ through F:
|
|
165
|
+
|
|
166
|
+
- Start at 100, apply deductions for anti-patterns
|
|
167
|
+
- Bonuses for strong read/write ratios and good parallelism
|
|
168
|
+
- A+ (95+), A (90+), B (75+), C (60+), D (45+), F (<45)
|
|
169
|
+
- All weights configurable via `.sesh/config.json`
|
|
170
|
+
|
|
171
|
+
## CLI reference
|
|
172
|
+
|
|
173
|
+
```
|
|
174
|
+
sesh init Initialize .sesh/ in current directory
|
|
175
|
+
sesh log <file> Ingest a session transcript
|
|
176
|
+
sesh log --dir <dir> Batch ingest all transcripts in a directory
|
|
177
|
+
sesh reflect [session_id] Analyze a session (default: most recent)
|
|
178
|
+
sesh report [--last N] Cross-session trend analysis
|
|
179
|
+
sesh handoff [session_id] Generate handoff document
|
|
180
|
+
sesh search <query> Full-text search
|
|
181
|
+
sesh list [--last N] List sessions
|
|
182
|
+
sesh stats Aggregate statistics
|
|
183
|
+
sesh export <session_id> Export session as JSON
|
|
184
|
+
sesh watch [dirs...] Auto-ingest new sessions (polls continuously)
|
|
185
|
+
sesh watch --once [dirs...] One-shot scan and ingest
|
|
186
|
+
|
|
187
|
+
Watch flags:
|
|
188
|
+
--interval N Poll interval in seconds (default: 30)
|
|
189
|
+
--settle N Seconds since last modification (default: 60)
|
|
190
|
+
|
|
191
|
+
Global flags:
|
|
192
|
+
--json Output as JSON
|
|
193
|
+
--db <path> Override database path
|
|
194
|
+
--quiet Suppress non-essential output
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
## Configuration
|
|
198
|
+
|
|
199
|
+
`sesh init` creates `.sesh/config.json` with sensible defaults. Everything is tunable:
|
|
200
|
+
|
|
201
|
+
```json
|
|
202
|
+
{
|
|
203
|
+
"patterns": {
|
|
204
|
+
"thresholds": {
|
|
205
|
+
"error_rate_concern": 0.15,
|
|
206
|
+
"bash_overuse_min": 3,
|
|
207
|
+
"error_streak_min": 3
|
|
208
|
+
}
|
|
209
|
+
},
|
|
210
|
+
"grading": {
|
|
211
|
+
"error_rate_max_deduction": 20,
|
|
212
|
+
"blind_edit_deduction": 5,
|
|
213
|
+
"read_ratio_bonus": 5
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
## Supported formats
|
|
219
|
+
|
|
220
|
+
- **Claude Code** (.jsonl) — fully supported
|
|
221
|
+
- **OpenAI Codex CLI** (.jsonl) — fully supported (auto-detected, maps `exec_command`→Bash, `apply_patch`→Edit)
|
|
222
|
+
- Generic — planned
|
|
223
|
+
|
|
224
|
+
## Requirements
|
|
225
|
+
|
|
226
|
+
- Python 3.10+
|
|
227
|
+
- `mcp` package (for MCP server only)
|
|
228
|
+
- No other external dependencies
|
|
229
|
+
|
|
230
|
+
## License
|
|
231
|
+
|
|
232
|
+
MIT
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
# sesh
|
|
2
|
+
|
|
3
|
+
Agent session intelligence. Behavioral analysis, grading, and self-improvement for AI coding agents.
|
|
4
|
+
|
|
5
|
+
sesh parses agent session transcripts, detects anti-patterns, grades sessions, and tracks trends over time. Built so agents can analyze themselves — and so humans can see what their agents are doing.
|
|
6
|
+
|
|
7
|
+
## Three interfaces, one engine
|
|
8
|
+
|
|
9
|
+
| Interface | For | How |
|
|
10
|
+
|-----------|-----|-----|
|
|
11
|
+
| **CLI** | Developers in the terminal | `sesh reflect`, `sesh report`, `sesh search` |
|
|
12
|
+
| **MCP Server** | Agents at runtime | Add to your MCP config, agent calls `sesh_reflect` |
|
|
13
|
+
| **Web Dashboard** | Humans who want observability | `sesh-web` → browser dashboard on localhost |
|
|
14
|
+
|
|
15
|
+
All three use the same analysis engine and database. Install once, use from anywhere.
|
|
16
|
+
|
|
17
|
+
## Install
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
pip install agentsesh
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Or from source:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
git clone https://github.com/ateeples/agentsesh.git
|
|
27
|
+
cd agentsesh
|
|
28
|
+
pip install -e .
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Quick start
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
# Initialize in your project
|
|
35
|
+
sesh init
|
|
36
|
+
|
|
37
|
+
# Auto-discover and ingest all Claude Code sessions
|
|
38
|
+
sesh watch --once
|
|
39
|
+
|
|
40
|
+
# See your most recent session analysis
|
|
41
|
+
sesh reflect
|
|
42
|
+
|
|
43
|
+
# Cross-session trends
|
|
44
|
+
sesh report
|
|
45
|
+
|
|
46
|
+
# Search past sessions
|
|
47
|
+
sesh search "authentication bug"
|
|
48
|
+
|
|
49
|
+
# Keep ingesting new sessions in the background
|
|
50
|
+
sesh watch
|
|
51
|
+
|
|
52
|
+
# Launch the dashboard
|
|
53
|
+
sesh-web
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## MCP Server (agent-native)
|
|
57
|
+
|
|
58
|
+
Add sesh to your agent's MCP configuration so it can self-analyze at runtime.
|
|
59
|
+
|
|
60
|
+
**Claude Code** (`~/.claude/settings.json`):
|
|
61
|
+
|
|
62
|
+
```json
|
|
63
|
+
{
|
|
64
|
+
"mcpServers": {
|
|
65
|
+
"sesh": {
|
|
66
|
+
"command": "sesh-mcp",
|
|
67
|
+
"env": {
|
|
68
|
+
"SESH_DB": "/path/to/your/project/.sesh/sesh.db"
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
**Claude Desktop** (`claude_desktop_config.json`):
|
|
76
|
+
|
|
77
|
+
```json
|
|
78
|
+
{
|
|
79
|
+
"mcpServers": {
|
|
80
|
+
"sesh": {
|
|
81
|
+
"command": "sesh-mcp",
|
|
82
|
+
"env": {
|
|
83
|
+
"SESH_DB": "/path/to/your/project/.sesh/sesh.db"
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
Once configured, the agent has access to these tools:
|
|
91
|
+
|
|
92
|
+
| Tool | What it does |
|
|
93
|
+
|------|-------------|
|
|
94
|
+
| `sesh_reflect` | Full session analysis — grade, patterns, tool usage |
|
|
95
|
+
| `sesh_report` | Cross-session trends — improving, stable, or declining |
|
|
96
|
+
| `sesh_handoff` | Structured handoff doc for session continuity |
|
|
97
|
+
| `sesh_search` | Full-text search across all sessions |
|
|
98
|
+
| `sesh_list` | List recent sessions with grades |
|
|
99
|
+
| `sesh_stats` | Lifetime aggregate statistics |
|
|
100
|
+
| `sesh_log` | Ingest a new transcript |
|
|
101
|
+
| `sesh_sync` | Auto-discover and ingest new sessions |
|
|
102
|
+
| `sesh_patterns` | Detailed pattern breakdown for a session |
|
|
103
|
+
|
|
104
|
+
An agent can call `sesh_sync` then `sesh_reflect` at session start to auto-ingest new transcripts and review its last session, or `sesh_report` to see if it's been improving or repeating the same mistakes.
|
|
105
|
+
|
|
106
|
+
## Web Dashboard
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
sesh-web # http://127.0.0.1:7433
|
|
110
|
+
sesh-web --port 8080 # custom port
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
The dashboard shows:
|
|
114
|
+
- Session grades and score trends
|
|
115
|
+
- Grade distribution across all sessions
|
|
116
|
+
- Tool usage breakdown
|
|
117
|
+
- Recurring anti-patterns
|
|
118
|
+
- Full-text session search
|
|
119
|
+
|
|
120
|
+
Auto-refreshes every 30 seconds — leave it open while your agent works.
|
|
121
|
+
|
|
122
|
+
## What it detects
|
|
123
|
+
|
|
124
|
+
sesh runs 9 pattern detectors on every session:
|
|
125
|
+
|
|
126
|
+
| Pattern | What it catches |
|
|
127
|
+
|---------|----------------|
|
|
128
|
+
| `repeated_searches` | Same search query run multiple times |
|
|
129
|
+
| `write_without_read` | Editing a file that was never read |
|
|
130
|
+
| `error_rate` | Overall error percentage above threshold |
|
|
131
|
+
| `error_streak` | Consecutive errors (agent stuck in a loop) |
|
|
132
|
+
| `low_read_ratio` | Not enough reading relative to writing |
|
|
133
|
+
| `bash_overuse` | Using bash for cat/grep/find when dedicated tools exist |
|
|
134
|
+
| `write_then_read` | Writing before understanding (acted before reading) |
|
|
135
|
+
| `scattered_files` | Touching too many directories (unfocused session) |
|
|
136
|
+
| `missed_parallelism` | Sequential reads that could have been parallel |
|
|
137
|
+
|
|
138
|
+
## Grading
|
|
139
|
+
|
|
140
|
+
Sessions are scored 0–100 and graded A+ through F:
|
|
141
|
+
|
|
142
|
+
- Start at 100, apply deductions for anti-patterns
|
|
143
|
+
- Bonuses for strong read/write ratios and good parallelism
|
|
144
|
+
- A+ (95+), A (90+), B (75+), C (60+), D (45+), F (<45)
|
|
145
|
+
- All weights configurable via `.sesh/config.json`
|
|
146
|
+
|
|
147
|
+
## CLI reference
|
|
148
|
+
|
|
149
|
+
```
|
|
150
|
+
sesh init Initialize .sesh/ in current directory
|
|
151
|
+
sesh log <file> Ingest a session transcript
|
|
152
|
+
sesh log --dir <dir> Batch ingest all transcripts in a directory
|
|
153
|
+
sesh reflect [session_id] Analyze a session (default: most recent)
|
|
154
|
+
sesh report [--last N] Cross-session trend analysis
|
|
155
|
+
sesh handoff [session_id] Generate handoff document
|
|
156
|
+
sesh search <query> Full-text search
|
|
157
|
+
sesh list [--last N] List sessions
|
|
158
|
+
sesh stats Aggregate statistics
|
|
159
|
+
sesh export <session_id> Export session as JSON
|
|
160
|
+
sesh watch [dirs...] Auto-ingest new sessions (polls continuously)
|
|
161
|
+
sesh watch --once [dirs...] One-shot scan and ingest
|
|
162
|
+
|
|
163
|
+
Watch flags:
|
|
164
|
+
--interval N Poll interval in seconds (default: 30)
|
|
165
|
+
--settle N Seconds since last modification (default: 60)
|
|
166
|
+
|
|
167
|
+
Global flags:
|
|
168
|
+
--json Output as JSON
|
|
169
|
+
--db <path> Override database path
|
|
170
|
+
--quiet Suppress non-essential output
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
## Configuration
|
|
174
|
+
|
|
175
|
+
`sesh init` creates `.sesh/config.json` with sensible defaults. Everything is tunable:
|
|
176
|
+
|
|
177
|
+
```json
|
|
178
|
+
{
|
|
179
|
+
"patterns": {
|
|
180
|
+
"thresholds": {
|
|
181
|
+
"error_rate_concern": 0.15,
|
|
182
|
+
"bash_overuse_min": 3,
|
|
183
|
+
"error_streak_min": 3
|
|
184
|
+
}
|
|
185
|
+
},
|
|
186
|
+
"grading": {
|
|
187
|
+
"error_rate_max_deduction": 20,
|
|
188
|
+
"blind_edit_deduction": 5,
|
|
189
|
+
"read_ratio_bonus": 5
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
## Supported formats
|
|
195
|
+
|
|
196
|
+
- **Claude Code** (.jsonl) — fully supported
|
|
197
|
+
- **OpenAI Codex CLI** (.jsonl) — fully supported (auto-detected, maps `exec_command`→Bash, `apply_patch`→Edit)
|
|
198
|
+
- Generic — planned
|
|
199
|
+
|
|
200
|
+
## Requirements
|
|
201
|
+
|
|
202
|
+
- Python 3.10+
|
|
203
|
+
- `mcp` package (for MCP server only)
|
|
204
|
+
- No other external dependencies
|
|
205
|
+
|
|
206
|
+
## License
|
|
207
|
+
|
|
208
|
+
MIT
|
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: agentsesh
|
|
3
|
+
Version: 0.4.0
|
|
4
|
+
Summary: Agent session intelligence — behavioral analysis, grading, and handoff for AI agent sessions
|
|
5
|
+
License: MIT
|
|
6
|
+
Project-URL: Homepage, https://agentsesh.com
|
|
7
|
+
Project-URL: Repository, https://github.com/ateeples/agentsesh
|
|
8
|
+
Classifier: Development Status :: 3 - Alpha
|
|
9
|
+
Classifier: Environment :: Console
|
|
10
|
+
Classifier: Intended Audience :: Developers
|
|
11
|
+
Classifier: Topic :: Software Development :: Quality Assurance
|
|
12
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
18
|
+
Requires-Python: >=3.10
|
|
19
|
+
Description-Content-Type: text/markdown
|
|
20
|
+
Provides-Extra: mcp
|
|
21
|
+
Requires-Dist: mcp>=1.0; extra == "mcp"
|
|
22
|
+
Provides-Extra: all
|
|
23
|
+
Requires-Dist: mcp>=1.0; extra == "all"
|
|
24
|
+
|
|
25
|
+
# sesh
|
|
26
|
+
|
|
27
|
+
Agent session intelligence. Behavioral analysis, grading, and self-improvement for AI coding agents.
|
|
28
|
+
|
|
29
|
+
sesh parses agent session transcripts, detects anti-patterns, grades sessions, and tracks trends over time. Built so agents can analyze themselves — and so humans can see what their agents are doing.
|
|
30
|
+
|
|
31
|
+
## Three interfaces, one engine
|
|
32
|
+
|
|
33
|
+
| Interface | For | How |
|
|
34
|
+
|-----------|-----|-----|
|
|
35
|
+
| **CLI** | Developers in the terminal | `sesh reflect`, `sesh report`, `sesh search` |
|
|
36
|
+
| **MCP Server** | Agents at runtime | Add to your MCP config, agent calls `sesh_reflect` |
|
|
37
|
+
| **Web Dashboard** | Humans who want observability | `sesh-web` → browser dashboard on localhost |
|
|
38
|
+
|
|
39
|
+
All three use the same analysis engine and database. Install once, use from anywhere.
|
|
40
|
+
|
|
41
|
+
## Install
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
pip install agentsesh
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Or from source:
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
git clone https://github.com/ateeples/agentsesh.git
|
|
51
|
+
cd agentsesh
|
|
52
|
+
pip install -e .
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Quick start
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
# Initialize in your project
|
|
59
|
+
sesh init
|
|
60
|
+
|
|
61
|
+
# Auto-discover and ingest all Claude Code sessions
|
|
62
|
+
sesh watch --once
|
|
63
|
+
|
|
64
|
+
# See your most recent session analysis
|
|
65
|
+
sesh reflect
|
|
66
|
+
|
|
67
|
+
# Cross-session trends
|
|
68
|
+
sesh report
|
|
69
|
+
|
|
70
|
+
# Search past sessions
|
|
71
|
+
sesh search "authentication bug"
|
|
72
|
+
|
|
73
|
+
# Keep ingesting new sessions in the background
|
|
74
|
+
sesh watch
|
|
75
|
+
|
|
76
|
+
# Launch the dashboard
|
|
77
|
+
sesh-web
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## MCP Server (agent-native)
|
|
81
|
+
|
|
82
|
+
Add sesh to your agent's MCP configuration so it can self-analyze at runtime.
|
|
83
|
+
|
|
84
|
+
**Claude Code** (`~/.claude/settings.json`):
|
|
85
|
+
|
|
86
|
+
```json
|
|
87
|
+
{
|
|
88
|
+
"mcpServers": {
|
|
89
|
+
"sesh": {
|
|
90
|
+
"command": "sesh-mcp",
|
|
91
|
+
"env": {
|
|
92
|
+
"SESH_DB": "/path/to/your/project/.sesh/sesh.db"
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
**Claude Desktop** (`claude_desktop_config.json`):
|
|
100
|
+
|
|
101
|
+
```json
|
|
102
|
+
{
|
|
103
|
+
"mcpServers": {
|
|
104
|
+
"sesh": {
|
|
105
|
+
"command": "sesh-mcp",
|
|
106
|
+
"env": {
|
|
107
|
+
"SESH_DB": "/path/to/your/project/.sesh/sesh.db"
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
Once configured, the agent has access to these tools:
|
|
115
|
+
|
|
116
|
+
| Tool | What it does |
|
|
117
|
+
|------|-------------|
|
|
118
|
+
| `sesh_reflect` | Full session analysis — grade, patterns, tool usage |
|
|
119
|
+
| `sesh_report` | Cross-session trends — improving, stable, or declining |
|
|
120
|
+
| `sesh_handoff` | Structured handoff doc for session continuity |
|
|
121
|
+
| `sesh_search` | Full-text search across all sessions |
|
|
122
|
+
| `sesh_list` | List recent sessions with grades |
|
|
123
|
+
| `sesh_stats` | Lifetime aggregate statistics |
|
|
124
|
+
| `sesh_log` | Ingest a new transcript |
|
|
125
|
+
| `sesh_sync` | Auto-discover and ingest new sessions |
|
|
126
|
+
| `sesh_patterns` | Detailed pattern breakdown for a session |
|
|
127
|
+
|
|
128
|
+
An agent can call `sesh_sync` then `sesh_reflect` at session start to auto-ingest new transcripts and review its last session, or `sesh_report` to see if it's been improving or repeating the same mistakes.
|
|
129
|
+
|
|
130
|
+
## Web Dashboard
|
|
131
|
+
|
|
132
|
+
```bash
|
|
133
|
+
sesh-web # http://127.0.0.1:7433
|
|
134
|
+
sesh-web --port 8080 # custom port
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
The dashboard shows:
|
|
138
|
+
- Session grades and score trends
|
|
139
|
+
- Grade distribution across all sessions
|
|
140
|
+
- Tool usage breakdown
|
|
141
|
+
- Recurring anti-patterns
|
|
142
|
+
- Full-text session search
|
|
143
|
+
|
|
144
|
+
Auto-refreshes every 30 seconds — leave it open while your agent works.
|
|
145
|
+
|
|
146
|
+
## What it detects
|
|
147
|
+
|
|
148
|
+
sesh runs 9 pattern detectors on every session:
|
|
149
|
+
|
|
150
|
+
| Pattern | What it catches |
|
|
151
|
+
|---------|----------------|
|
|
152
|
+
| `repeated_searches` | Same search query run multiple times |
|
|
153
|
+
| `write_without_read` | Editing a file that was never read |
|
|
154
|
+
| `error_rate` | Overall error percentage above threshold |
|
|
155
|
+
| `error_streak` | Consecutive errors (agent stuck in a loop) |
|
|
156
|
+
| `low_read_ratio` | Not enough reading relative to writing |
|
|
157
|
+
| `bash_overuse` | Using bash for cat/grep/find when dedicated tools exist |
|
|
158
|
+
| `write_then_read` | Writing before understanding (acted before reading) |
|
|
159
|
+
| `scattered_files` | Touching too many directories (unfocused session) |
|
|
160
|
+
| `missed_parallelism` | Sequential reads that could have been parallel |
|
|
161
|
+
|
|
162
|
+
## Grading
|
|
163
|
+
|
|
164
|
+
Sessions are scored 0–100 and graded A+ through F:
|
|
165
|
+
|
|
166
|
+
- Start at 100, apply deductions for anti-patterns
|
|
167
|
+
- Bonuses for strong read/write ratios and good parallelism
|
|
168
|
+
- A+ (95+), A (90+), B (75+), C (60+), D (45+), F (<45)
|
|
169
|
+
- All weights configurable via `.sesh/config.json`
|
|
170
|
+
|
|
171
|
+
## CLI reference
|
|
172
|
+
|
|
173
|
+
```
|
|
174
|
+
sesh init Initialize .sesh/ in current directory
|
|
175
|
+
sesh log <file> Ingest a session transcript
|
|
176
|
+
sesh log --dir <dir> Batch ingest all transcripts in a directory
|
|
177
|
+
sesh reflect [session_id] Analyze a session (default: most recent)
|
|
178
|
+
sesh report [--last N] Cross-session trend analysis
|
|
179
|
+
sesh handoff [session_id] Generate handoff document
|
|
180
|
+
sesh search <query> Full-text search
|
|
181
|
+
sesh list [--last N] List sessions
|
|
182
|
+
sesh stats Aggregate statistics
|
|
183
|
+
sesh export <session_id> Export session as JSON
|
|
184
|
+
sesh watch [dirs...] Auto-ingest new sessions (polls continuously)
|
|
185
|
+
sesh watch --once [dirs...] One-shot scan and ingest
|
|
186
|
+
|
|
187
|
+
Watch flags:
|
|
188
|
+
--interval N Poll interval in seconds (default: 30)
|
|
189
|
+
--settle N Seconds since last modification (default: 60)
|
|
190
|
+
|
|
191
|
+
Global flags:
|
|
192
|
+
--json Output as JSON
|
|
193
|
+
--db <path> Override database path
|
|
194
|
+
--quiet Suppress non-essential output
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
## Configuration
|
|
198
|
+
|
|
199
|
+
`sesh init` creates `.sesh/config.json` with sensible defaults. Everything is tunable:
|
|
200
|
+
|
|
201
|
+
```json
|
|
202
|
+
{
|
|
203
|
+
"patterns": {
|
|
204
|
+
"thresholds": {
|
|
205
|
+
"error_rate_concern": 0.15,
|
|
206
|
+
"bash_overuse_min": 3,
|
|
207
|
+
"error_streak_min": 3
|
|
208
|
+
}
|
|
209
|
+
},
|
|
210
|
+
"grading": {
|
|
211
|
+
"error_rate_max_deduction": 20,
|
|
212
|
+
"blind_edit_deduction": 5,
|
|
213
|
+
"read_ratio_bonus": 5
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
## Supported formats
|
|
219
|
+
|
|
220
|
+
- **Claude Code** (.jsonl) — fully supported
|
|
221
|
+
- **OpenAI Codex CLI** (.jsonl) — fully supported (auto-detected, maps `exec_command`→Bash, `apply_patch`→Edit)
|
|
222
|
+
- Generic — planned
|
|
223
|
+
|
|
224
|
+
## Requirements
|
|
225
|
+
|
|
226
|
+
- Python 3.10+
|
|
227
|
+
- `mcp` package (for MCP server only)
|
|
228
|
+
- No other external dependencies
|
|
229
|
+
|
|
230
|
+
## License
|
|
231
|
+
|
|
232
|
+
MIT
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
README.md
|
|
2
|
+
pyproject.toml
|
|
3
|
+
agentsesh.egg-info/PKG-INFO
|
|
4
|
+
agentsesh.egg-info/SOURCES.txt
|
|
5
|
+
agentsesh.egg-info/dependency_links.txt
|
|
6
|
+
agentsesh.egg-info/entry_points.txt
|
|
7
|
+
agentsesh.egg-info/requires.txt
|
|
8
|
+
agentsesh.egg-info/top_level.txt
|
|
9
|
+
sesh/__init__.py
|
|
10
|
+
sesh/__main__.py
|
|
11
|
+
sesh/cli.py
|
|
12
|
+
sesh/config.py
|
|
13
|
+
sesh/db.py
|
|
14
|
+
sesh/mcp_server.py
|
|
15
|
+
sesh/py.typed
|
|
16
|
+
sesh/watch.py
|
|
17
|
+
sesh/analyzers/__init__.py
|
|
18
|
+
sesh/analyzers/grader.py
|
|
19
|
+
sesh/analyzers/patterns.py
|
|
20
|
+
sesh/analyzers/trends.py
|
|
21
|
+
sesh/formatters/__init__.py
|
|
22
|
+
sesh/formatters/handoff.py
|
|
23
|
+
sesh/formatters/json_out.py
|
|
24
|
+
sesh/formatters/report.py
|
|
25
|
+
sesh/parsers/__init__.py
|
|
26
|
+
sesh/parsers/base.py
|
|
27
|
+
sesh/parsers/claude_code.py
|
|
28
|
+
sesh/parsers/openai_codex.py
|
|
29
|
+
sesh/web/__init__.py
|
|
30
|
+
sesh/web/server.py
|
|
31
|
+
tests/test_cli.py
|
|
32
|
+
tests/test_grader.py
|
|
33
|
+
tests/test_openai_parser.py
|
|
34
|
+
tests/test_parser.py
|
|
35
|
+
tests/test_patterns.py
|
|
36
|
+
tests/test_watch.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|