nietzschian-debugger 0.2.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.
- nietzschian_debugger-0.2.0/LICENSE +21 -0
- nietzschian_debugger-0.2.0/PKG-INFO +208 -0
- nietzschian_debugger-0.2.0/README.md +176 -0
- nietzschian_debugger-0.2.0/nietzschian_debugger/__init__.py +7 -0
- nietzschian_debugger-0.2.0/nietzschian_debugger/cli.py +46 -0
- nietzschian_debugger-0.2.0/nietzschian_debugger/commands/__init__.py +0 -0
- nietzschian_debugger-0.2.0/nietzschian_debugger/commands/debug.py +84 -0
- nietzschian_debugger-0.2.0/nietzschian_debugger/core/__init__.py +0 -0
- nietzschian_debugger-0.2.0/nietzschian_debugger/core/context_manager.py +126 -0
- nietzschian_debugger-0.2.0/nietzschian_debugger/core/session.py +84 -0
- nietzschian_debugger-0.2.0/nietzschian_debugger/core/session_loop.py +247 -0
- nietzschian_debugger-0.2.0/nietzschian_debugger/llm/__init__.py +0 -0
- nietzschian_debugger-0.2.0/nietzschian_debugger/llm/client.py +126 -0
- nietzschian_debugger-0.2.0/nietzschian_debugger/llm/prompts.py +135 -0
- nietzschian_debugger-0.2.0/nietzschian_debugger/llm/validator.py +106 -0
- nietzschian_debugger-0.2.0/nietzschian_debugger/quotes/__init__.py +0 -0
- nietzschian_debugger-0.2.0/nietzschian_debugger/quotes/corpus.py +51 -0
- nietzschian_debugger-0.2.0/nietzschian_debugger/quotes/selector.py +75 -0
- nietzschian_debugger-0.2.0/nietzschian_debugger/scoring/__init__.py +0 -0
- nietzschian_debugger-0.2.0/nietzschian_debugger/scoring/behavior_tagger.py +74 -0
- nietzschian_debugger-0.2.0/nietzschian_debugger/scoring/growth_profile.py +99 -0
- nietzschian_debugger-0.2.0/nietzschian_debugger/scoring/skill_scorer.py +49 -0
- nietzschian_debugger-0.2.0/nietzschian_debugger/storage/__init__.py +0 -0
- nietzschian_debugger-0.2.0/nietzschian_debugger/storage/file_reader.py +71 -0
- nietzschian_debugger-0.2.0/nietzschian_debugger/storage/session_store.py +208 -0
- nietzschian_debugger-0.2.0/nietzschian_debugger/types.py +78 -0
- nietzschian_debugger-0.2.0/nietzschian_debugger/ui/__init__.py +0 -0
- nietzschian_debugger-0.2.0/nietzschian_debugger/ui/growth_display.py +96 -0
- nietzschian_debugger-0.2.0/nietzschian_debugger/ui/renderer.py +83 -0
- nietzschian_debugger-0.2.0/nietzschian_debugger.egg-info/PKG-INFO +208 -0
- nietzschian_debugger-0.2.0/nietzschian_debugger.egg-info/SOURCES.txt +35 -0
- nietzschian_debugger-0.2.0/nietzschian_debugger.egg-info/dependency_links.txt +1 -0
- nietzschian_debugger-0.2.0/nietzschian_debugger.egg-info/entry_points.txt +2 -0
- nietzschian_debugger-0.2.0/nietzschian_debugger.egg-info/requires.txt +7 -0
- nietzschian_debugger-0.2.0/nietzschian_debugger.egg-info/top_level.txt +1 -0
- nietzschian_debugger-0.2.0/pyproject.toml +67 -0
- nietzschian_debugger-0.2.0/setup.cfg +4 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Dilawar Gopang
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: nietzschian-debugger
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: It won't fix your bug. It'll fix you. What doesn't kill your code makes it stronger. Confrontational questioning for developers.
|
|
5
|
+
Author-email: Dilawar Shafiq <dilawar.gopang@gmail.com>
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/DilawarShafiq/nietzschian-debugger
|
|
8
|
+
Project-URL: Repository, https://github.com/DilawarShafiq/nietzschian-debugger
|
|
9
|
+
Project-URL: Issues, https://github.com/DilawarShafiq/nietzschian-debugger/issues
|
|
10
|
+
Keywords: debugging,education,nietzsche,philosophy,developer-tools,ai,learning,critical-thinking,cli,socratic,anthropic,claude
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
19
|
+
Classifier: Topic :: Software Development :: Debuggers
|
|
20
|
+
Classifier: Topic :: Education
|
|
21
|
+
Classifier: Environment :: Console
|
|
22
|
+
Requires-Python: >=3.10
|
|
23
|
+
Description-Content-Type: text/markdown
|
|
24
|
+
License-File: LICENSE
|
|
25
|
+
Requires-Dist: anthropic>=0.40.0
|
|
26
|
+
Requires-Dist: click>=8.1.0
|
|
27
|
+
Requires-Dist: rich>=13.0.0
|
|
28
|
+
Provides-Extra: dev
|
|
29
|
+
Requires-Dist: pytest>=7.0.0; extra == "dev"
|
|
30
|
+
Requires-Dist: pytest-asyncio>=0.23.0; extra == "dev"
|
|
31
|
+
Dynamic: license-file
|
|
32
|
+
|
|
33
|
+
# Nietzschian Debugger
|
|
34
|
+
|
|
35
|
+

|
|
36
|
+
|
|
37
|
+
> "What doesn't kill your code makes it stronger."
|
|
38
|
+
|
|
39
|
+
**It won't fix your bug. It'll fix you.** Every other tool hands you the answer; Nietzschian Debugger hands the question back.
|
|
40
|
+
|
|
41
|
+
You paste your bug. It doesn't fix it. Instead, it:
|
|
42
|
+
|
|
43
|
+
- Challenges your assumptions about what's happening
|
|
44
|
+
- Forces you to confront the evidence you're avoiding
|
|
45
|
+
- Tears apart your weak reasoning until only truth remains
|
|
46
|
+
- Guides you to the "aha!" moment — YOUR moment, not the AI's
|
|
47
|
+
|
|
48
|
+
## Why?
|
|
49
|
+
|
|
50
|
+
AI is making developers weaker. Copy-paste from ChatGPT, ship, repeat. Nobody understands their own code anymore. **Nietzschian Debugger forges stronger developers** — through struggle, not shortcuts.
|
|
51
|
+
|
|
52
|
+
This isn't anti-AI — it runs on Claude, on purpose. It's anti-*outsourcing-your-thinking*. Every other tool uses the model to hand you the answer; this one uses it to hand the question back.
|
|
53
|
+
|
|
54
|
+
> "He who has a why to debug can bear almost any how."
|
|
55
|
+
|
|
56
|
+
## Installation
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
# Python 3.10+
|
|
60
|
+
pip install nietzschian-debugger
|
|
61
|
+
nietzschian debug "your bug"
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
> **Note:** the current tool is the Python package above. The old `npx nietzschian-debugger` serves a stale pre-rewrite build — it has been deprecated in favour of the pip install.
|
|
65
|
+
|
|
66
|
+
**Requirements:**
|
|
67
|
+
- Python >= 3.10
|
|
68
|
+
- An Anthropic API key (BYOK — bring your own key)
|
|
69
|
+
|
|
70
|
+
## Setup
|
|
71
|
+
|
|
72
|
+
Set your Anthropic API key:
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
# Linux / macOS
|
|
76
|
+
export ANTHROPIC_API_KEY="sk-ant-..."
|
|
77
|
+
|
|
78
|
+
# Windows (PowerShell)
|
|
79
|
+
$env:ANTHROPIC_API_KEY = "sk-ant-..."
|
|
80
|
+
|
|
81
|
+
# Windows (CMD)
|
|
82
|
+
set ANTHROPIC_API_KEY=sk-ant-...
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## Quick Start
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
# Start a debugging session (default: nietzsche intensity)
|
|
89
|
+
nietzschian debug "My API returns 500 but only on Tuesdays"
|
|
90
|
+
|
|
91
|
+
# Gentle mode — for when you need guidance, not punishment
|
|
92
|
+
nietzschian debug --intensity socrates "My login endpoint fails randomly"
|
|
93
|
+
|
|
94
|
+
# Maximum intensity — for seniors who want pain
|
|
95
|
+
nietzschian debug --intensity zarathustra "Memory leak in production"
|
|
96
|
+
|
|
97
|
+
# Point it at specific code
|
|
98
|
+
nietzschian debug "Auth fails in ./src/middleware/auth.ts"
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
## Three Intensity Levels
|
|
102
|
+
|
|
103
|
+
| Level | Style | Best For |
|
|
104
|
+
|-------|-------|----------|
|
|
105
|
+
| `socrates` | Warm, guiding, scaffolded questions | Juniors, learning fundamentals |
|
|
106
|
+
| `nietzsche` | Direct, confrontational, no hand-holding | Daily debugging (default) |
|
|
107
|
+
| `zarathustra` | Brutal, adversarial, hostile to weak reasoning | Seniors who want real pain |
|
|
108
|
+
|
|
109
|
+
## How a Session Looks
|
|
110
|
+
|
|
111
|
+
```
|
|
112
|
+
Nietzschian Debugger v0.2.0 — intensity: nietzsche
|
|
113
|
+
|
|
114
|
+
You: My login endpoint returns 403 for some users
|
|
115
|
+
|
|
116
|
+
Nietzschian: You say "some users." That's vague. What separates
|
|
117
|
+
the ones who fail from the ones who don't?
|
|
118
|
+
|
|
119
|
+
You: I'm not sure, it seems random
|
|
120
|
+
|
|
121
|
+
Nietzschian: "Random" is the word we use when we haven't looked
|
|
122
|
+
hard enough. What do the server logs say for the 403
|
|
123
|
+
responses? Go look. I'll wait.
|
|
124
|
+
|
|
125
|
+
You: Let me check... oh, they all have expired JWT tokens
|
|
126
|
+
|
|
127
|
+
Nietzschian: Now we're getting somewhere. Why would some users
|
|
128
|
+
have expired tokens while others don't? What changed
|
|
129
|
+
recently in your auth system?
|
|
130
|
+
|
|
131
|
+
You: ... oh. We changed the token TTL last week and didn't
|
|
132
|
+
invalidate existing sessions.
|
|
133
|
+
|
|
134
|
+
Nietzschian: There it is. You didn't need me to tell you — you
|
|
135
|
+
needed to be forced to look.
|
|
136
|
+
|
|
137
|
+
Session Complete — 4 questions to root cause (Solved)
|
|
138
|
+
|
|
139
|
+
Your Debugging Profile:
|
|
140
|
+
┣ Assumption-checking ██████████ strong
|
|
141
|
+
┣ Evidence-gathering ██████░░░░ moderate
|
|
142
|
+
┗ Root cause speed ████████░░ strong
|
|
143
|
+
|
|
144
|
+
"Man is something that shall be overcome."
|
|
145
|
+
— Friedrich Nietzsche
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
## Session Commands
|
|
149
|
+
|
|
150
|
+
| Command | Effect |
|
|
151
|
+
|---------|--------|
|
|
152
|
+
| `solved` or `found it` | End session — you found the root cause |
|
|
153
|
+
| `I give up` | Get one lifeline question, then exit |
|
|
154
|
+
| `exit` or `quit` | Abandon session immediately |
|
|
155
|
+
| `Ctrl+C` / `Ctrl+D` | Force quit |
|
|
156
|
+
|
|
157
|
+
## Features
|
|
158
|
+
|
|
159
|
+
- **Never Gives Answers** — Every response is a question. The tool will NEVER tell you the fix.
|
|
160
|
+
- **Real Code Reading** — Reference a file path and it reads YOUR actual code, not generic examples.
|
|
161
|
+
- **Contextual Philosophy** — Nietzsche when you're avoiding, Seneca when overwhelmed, Sun Tzu when you need strategy.
|
|
162
|
+
- **Growth Score** — Track your debugging skills across sessions with visual bar charts.
|
|
163
|
+
- **Session History** — All sessions saved locally in `.nietzschian/sessions/` for trend tracking.
|
|
164
|
+
- **Sliding Context** — Long sessions don't crash; older turns are transparently summarized.
|
|
165
|
+
|
|
166
|
+
## The Philosophy
|
|
167
|
+
|
|
168
|
+
| Traditional AI | Nietzschian Debugger |
|
|
169
|
+
|---------------|---------------------|
|
|
170
|
+
| "Here's the fix" | "What have you tried?" |
|
|
171
|
+
| Makes you dependent | Makes you dangerous |
|
|
172
|
+
| You learn nothing | You learn everything |
|
|
173
|
+
| Fast but shallow | Painful but permanent |
|
|
174
|
+
| AI gets smarter | YOU get smarter |
|
|
175
|
+
|
|
176
|
+
## Who Is This For?
|
|
177
|
+
|
|
178
|
+
- **Junior developers** who want to actually learn, not just copy-paste
|
|
179
|
+
- **Senior developers** who miss the struggle that made them good
|
|
180
|
+
- **Engineering managers** who want their team thinking, not just prompting
|
|
181
|
+
- **Bootcamp students** building real debugging intuition
|
|
182
|
+
- **Anyone** who believes the best developer is a self-reliant one
|
|
183
|
+
|
|
184
|
+
## Development
|
|
185
|
+
|
|
186
|
+
```bash
|
|
187
|
+
# Clone and install
|
|
188
|
+
git clone https://github.com/DilawarShafiq/nietzschian-debugger.git
|
|
189
|
+
cd nietzschian-debugger
|
|
190
|
+
pip install -e ".[dev]"
|
|
191
|
+
|
|
192
|
+
# Run tests (121 tests)
|
|
193
|
+
pytest
|
|
194
|
+
|
|
195
|
+
# Run the CLI locally
|
|
196
|
+
nietzschian debug "test problem"
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
## Tech Stack
|
|
200
|
+
|
|
201
|
+
- Python >= 3.10
|
|
202
|
+
- Claude API via the Anthropic SDK
|
|
203
|
+
- Click for the CLI, Rich for the terminal UI
|
|
204
|
+
- pytest for testing
|
|
205
|
+
|
|
206
|
+
## License
|
|
207
|
+
|
|
208
|
+
MIT
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
# Nietzschian Debugger
|
|
2
|
+
|
|
3
|
+

|
|
4
|
+
|
|
5
|
+
> "What doesn't kill your code makes it stronger."
|
|
6
|
+
|
|
7
|
+
**It won't fix your bug. It'll fix you.** Every other tool hands you the answer; Nietzschian Debugger hands the question back.
|
|
8
|
+
|
|
9
|
+
You paste your bug. It doesn't fix it. Instead, it:
|
|
10
|
+
|
|
11
|
+
- Challenges your assumptions about what's happening
|
|
12
|
+
- Forces you to confront the evidence you're avoiding
|
|
13
|
+
- Tears apart your weak reasoning until only truth remains
|
|
14
|
+
- Guides you to the "aha!" moment — YOUR moment, not the AI's
|
|
15
|
+
|
|
16
|
+
## Why?
|
|
17
|
+
|
|
18
|
+
AI is making developers weaker. Copy-paste from ChatGPT, ship, repeat. Nobody understands their own code anymore. **Nietzschian Debugger forges stronger developers** — through struggle, not shortcuts.
|
|
19
|
+
|
|
20
|
+
This isn't anti-AI — it runs on Claude, on purpose. It's anti-*outsourcing-your-thinking*. Every other tool uses the model to hand you the answer; this one uses it to hand the question back.
|
|
21
|
+
|
|
22
|
+
> "He who has a why to debug can bear almost any how."
|
|
23
|
+
|
|
24
|
+
## Installation
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
# Python 3.10+
|
|
28
|
+
pip install nietzschian-debugger
|
|
29
|
+
nietzschian debug "your bug"
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
> **Note:** the current tool is the Python package above. The old `npx nietzschian-debugger` serves a stale pre-rewrite build — it has been deprecated in favour of the pip install.
|
|
33
|
+
|
|
34
|
+
**Requirements:**
|
|
35
|
+
- Python >= 3.10
|
|
36
|
+
- An Anthropic API key (BYOK — bring your own key)
|
|
37
|
+
|
|
38
|
+
## Setup
|
|
39
|
+
|
|
40
|
+
Set your Anthropic API key:
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
# Linux / macOS
|
|
44
|
+
export ANTHROPIC_API_KEY="sk-ant-..."
|
|
45
|
+
|
|
46
|
+
# Windows (PowerShell)
|
|
47
|
+
$env:ANTHROPIC_API_KEY = "sk-ant-..."
|
|
48
|
+
|
|
49
|
+
# Windows (CMD)
|
|
50
|
+
set ANTHROPIC_API_KEY=sk-ant-...
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Quick Start
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
# Start a debugging session (default: nietzsche intensity)
|
|
57
|
+
nietzschian debug "My API returns 500 but only on Tuesdays"
|
|
58
|
+
|
|
59
|
+
# Gentle mode — for when you need guidance, not punishment
|
|
60
|
+
nietzschian debug --intensity socrates "My login endpoint fails randomly"
|
|
61
|
+
|
|
62
|
+
# Maximum intensity — for seniors who want pain
|
|
63
|
+
nietzschian debug --intensity zarathustra "Memory leak in production"
|
|
64
|
+
|
|
65
|
+
# Point it at specific code
|
|
66
|
+
nietzschian debug "Auth fails in ./src/middleware/auth.ts"
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## Three Intensity Levels
|
|
70
|
+
|
|
71
|
+
| Level | Style | Best For |
|
|
72
|
+
|-------|-------|----------|
|
|
73
|
+
| `socrates` | Warm, guiding, scaffolded questions | Juniors, learning fundamentals |
|
|
74
|
+
| `nietzsche` | Direct, confrontational, no hand-holding | Daily debugging (default) |
|
|
75
|
+
| `zarathustra` | Brutal, adversarial, hostile to weak reasoning | Seniors who want real pain |
|
|
76
|
+
|
|
77
|
+
## How a Session Looks
|
|
78
|
+
|
|
79
|
+
```
|
|
80
|
+
Nietzschian Debugger v0.2.0 — intensity: nietzsche
|
|
81
|
+
|
|
82
|
+
You: My login endpoint returns 403 for some users
|
|
83
|
+
|
|
84
|
+
Nietzschian: You say "some users." That's vague. What separates
|
|
85
|
+
the ones who fail from the ones who don't?
|
|
86
|
+
|
|
87
|
+
You: I'm not sure, it seems random
|
|
88
|
+
|
|
89
|
+
Nietzschian: "Random" is the word we use when we haven't looked
|
|
90
|
+
hard enough. What do the server logs say for the 403
|
|
91
|
+
responses? Go look. I'll wait.
|
|
92
|
+
|
|
93
|
+
You: Let me check... oh, they all have expired JWT tokens
|
|
94
|
+
|
|
95
|
+
Nietzschian: Now we're getting somewhere. Why would some users
|
|
96
|
+
have expired tokens while others don't? What changed
|
|
97
|
+
recently in your auth system?
|
|
98
|
+
|
|
99
|
+
You: ... oh. We changed the token TTL last week and didn't
|
|
100
|
+
invalidate existing sessions.
|
|
101
|
+
|
|
102
|
+
Nietzschian: There it is. You didn't need me to tell you — you
|
|
103
|
+
needed to be forced to look.
|
|
104
|
+
|
|
105
|
+
Session Complete — 4 questions to root cause (Solved)
|
|
106
|
+
|
|
107
|
+
Your Debugging Profile:
|
|
108
|
+
┣ Assumption-checking ██████████ strong
|
|
109
|
+
┣ Evidence-gathering ██████░░░░ moderate
|
|
110
|
+
┗ Root cause speed ████████░░ strong
|
|
111
|
+
|
|
112
|
+
"Man is something that shall be overcome."
|
|
113
|
+
— Friedrich Nietzsche
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
## Session Commands
|
|
117
|
+
|
|
118
|
+
| Command | Effect |
|
|
119
|
+
|---------|--------|
|
|
120
|
+
| `solved` or `found it` | End session — you found the root cause |
|
|
121
|
+
| `I give up` | Get one lifeline question, then exit |
|
|
122
|
+
| `exit` or `quit` | Abandon session immediately |
|
|
123
|
+
| `Ctrl+C` / `Ctrl+D` | Force quit |
|
|
124
|
+
|
|
125
|
+
## Features
|
|
126
|
+
|
|
127
|
+
- **Never Gives Answers** — Every response is a question. The tool will NEVER tell you the fix.
|
|
128
|
+
- **Real Code Reading** — Reference a file path and it reads YOUR actual code, not generic examples.
|
|
129
|
+
- **Contextual Philosophy** — Nietzsche when you're avoiding, Seneca when overwhelmed, Sun Tzu when you need strategy.
|
|
130
|
+
- **Growth Score** — Track your debugging skills across sessions with visual bar charts.
|
|
131
|
+
- **Session History** — All sessions saved locally in `.nietzschian/sessions/` for trend tracking.
|
|
132
|
+
- **Sliding Context** — Long sessions don't crash; older turns are transparently summarized.
|
|
133
|
+
|
|
134
|
+
## The Philosophy
|
|
135
|
+
|
|
136
|
+
| Traditional AI | Nietzschian Debugger |
|
|
137
|
+
|---------------|---------------------|
|
|
138
|
+
| "Here's the fix" | "What have you tried?" |
|
|
139
|
+
| Makes you dependent | Makes you dangerous |
|
|
140
|
+
| You learn nothing | You learn everything |
|
|
141
|
+
| Fast but shallow | Painful but permanent |
|
|
142
|
+
| AI gets smarter | YOU get smarter |
|
|
143
|
+
|
|
144
|
+
## Who Is This For?
|
|
145
|
+
|
|
146
|
+
- **Junior developers** who want to actually learn, not just copy-paste
|
|
147
|
+
- **Senior developers** who miss the struggle that made them good
|
|
148
|
+
- **Engineering managers** who want their team thinking, not just prompting
|
|
149
|
+
- **Bootcamp students** building real debugging intuition
|
|
150
|
+
- **Anyone** who believes the best developer is a self-reliant one
|
|
151
|
+
|
|
152
|
+
## Development
|
|
153
|
+
|
|
154
|
+
```bash
|
|
155
|
+
# Clone and install
|
|
156
|
+
git clone https://github.com/DilawarShafiq/nietzschian-debugger.git
|
|
157
|
+
cd nietzschian-debugger
|
|
158
|
+
pip install -e ".[dev]"
|
|
159
|
+
|
|
160
|
+
# Run tests (121 tests)
|
|
161
|
+
pytest
|
|
162
|
+
|
|
163
|
+
# Run the CLI locally
|
|
164
|
+
nietzschian debug "test problem"
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
## Tech Stack
|
|
168
|
+
|
|
169
|
+
- Python >= 3.10
|
|
170
|
+
- Claude API via the Anthropic SDK
|
|
171
|
+
- Click for the CLI, Rich for the terminal UI
|
|
172
|
+
- pytest for testing
|
|
173
|
+
|
|
174
|
+
## License
|
|
175
|
+
|
|
176
|
+
MIT
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"""CLI entry point for the Nietzschian Debugger."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import asyncio
|
|
6
|
+
import sys
|
|
7
|
+
|
|
8
|
+
import click
|
|
9
|
+
|
|
10
|
+
from . import __version__
|
|
11
|
+
from .commands.debug import debug_command
|
|
12
|
+
|
|
13
|
+
VALID_INTENSITIES = ("socrates", "nietzsche", "zarathustra")
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
@click.group()
|
|
17
|
+
@click.version_option(version=__version__, prog_name="nietzschian")
|
|
18
|
+
def cli() -> None:
|
|
19
|
+
"""The anti-AI debugger. What doesn't kill your code makes it stronger."""
|
|
20
|
+
pass
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
@cli.command()
|
|
24
|
+
@click.argument("problem")
|
|
25
|
+
@click.option(
|
|
26
|
+
"-i",
|
|
27
|
+
"--intensity",
|
|
28
|
+
type=click.Choice(VALID_INTENSITIES, case_sensitive=False),
|
|
29
|
+
default="nietzsche",
|
|
30
|
+
help="Questioning intensity: socrates, nietzsche, zarathustra",
|
|
31
|
+
)
|
|
32
|
+
def debug(problem: str, intensity: str) -> None:
|
|
33
|
+
"""Start an interactive debugging session.
|
|
34
|
+
|
|
35
|
+
PROBLEM is the description of the bug or problem to debug.
|
|
36
|
+
"""
|
|
37
|
+
asyncio.run(debug_command(problem, intensity)) # type: ignore[arg-type]
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def main() -> None:
|
|
41
|
+
"""Main entry point."""
|
|
42
|
+
cli()
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
if __name__ == "__main__":
|
|
46
|
+
main()
|
|
File without changes
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"""Debug command - starts an interactive debugging session."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import asyncio
|
|
6
|
+
import sys
|
|
7
|
+
|
|
8
|
+
import anthropic
|
|
9
|
+
|
|
10
|
+
from ..types import Intensity
|
|
11
|
+
from ..llm.client import get_client, MissingApiKeyError
|
|
12
|
+
from ..core.session import create_session, finalize_session
|
|
13
|
+
from ..core.session_loop import run_session_loop
|
|
14
|
+
from ..storage.session_store import save_session
|
|
15
|
+
from ..scoring.behavior_tagger import tag_session_behaviors
|
|
16
|
+
from ..scoring.skill_scorer import compute_skill_scores
|
|
17
|
+
from ..scoring.growth_profile import compute_growth_profile
|
|
18
|
+
from ..quotes.selector import select_closing_quote
|
|
19
|
+
from ..ui.growth_display import render_growth_score
|
|
20
|
+
from ..ui.renderer import display_error, display_api_key_help
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
async def debug_command(problem_description: str, intensity: Intensity) -> None:
|
|
24
|
+
"""Run a full debugging session."""
|
|
25
|
+
# Validate API key
|
|
26
|
+
try:
|
|
27
|
+
get_client()
|
|
28
|
+
except MissingApiKeyError:
|
|
29
|
+
display_api_key_help()
|
|
30
|
+
sys.exit(1)
|
|
31
|
+
|
|
32
|
+
# Validate problem description
|
|
33
|
+
if not problem_description or not problem_description.strip():
|
|
34
|
+
display_error("Please provide a problem description.")
|
|
35
|
+
print('\nUsage: nietzschian debug "Your problem description here"')
|
|
36
|
+
sys.exit(2)
|
|
37
|
+
|
|
38
|
+
# Create session
|
|
39
|
+
session = create_session(problem_description.strip(), intensity)
|
|
40
|
+
|
|
41
|
+
try:
|
|
42
|
+
# Run interactive session
|
|
43
|
+
result = await run_session_loop(session)
|
|
44
|
+
|
|
45
|
+
# Finalize session
|
|
46
|
+
behavior_tags = session.behavior_tags
|
|
47
|
+
skill_scores = session.skill_scores
|
|
48
|
+
|
|
49
|
+
try:
|
|
50
|
+
behavior_tags = await tag_session_behaviors(session.transcript)
|
|
51
|
+
skill_scores = compute_skill_scores(behavior_tags)
|
|
52
|
+
except Exception:
|
|
53
|
+
# Scoring is best-effort
|
|
54
|
+
pass
|
|
55
|
+
|
|
56
|
+
finalize_session(session, result.outcome, skill_scores, behavior_tags)
|
|
57
|
+
|
|
58
|
+
# Save session
|
|
59
|
+
try:
|
|
60
|
+
await save_session(session)
|
|
61
|
+
except Exception:
|
|
62
|
+
# Persistence is best-effort
|
|
63
|
+
pass
|
|
64
|
+
|
|
65
|
+
# Display growth score
|
|
66
|
+
growth_profile = await compute_growth_profile()
|
|
67
|
+
closing_quote = select_closing_quote(result.outcome)
|
|
68
|
+
display = render_growth_score(session, growth_profile, closing_quote)
|
|
69
|
+
print(display)
|
|
70
|
+
|
|
71
|
+
sys.exit(0)
|
|
72
|
+
|
|
73
|
+
except anthropic.AuthenticationError:
|
|
74
|
+
display_error("Invalid API key. Check your ANTHROPIC_API_KEY.")
|
|
75
|
+
sys.exit(1)
|
|
76
|
+
except anthropic.RateLimitError:
|
|
77
|
+
display_error("Rate limit reached. Try again in a moment.")
|
|
78
|
+
sys.exit(3)
|
|
79
|
+
except anthropic.APIConnectionError:
|
|
80
|
+
display_error("Cannot reach Claude API. Check your connection.")
|
|
81
|
+
sys.exit(3)
|
|
82
|
+
except anthropic.APIError as e:
|
|
83
|
+
display_error(f"API error: {e.message}")
|
|
84
|
+
sys.exit(3)
|
|
File without changes
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
"""Context window management for long debugging sessions."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import math
|
|
6
|
+
from dataclasses import dataclass
|
|
7
|
+
from typing import Optional
|
|
8
|
+
|
|
9
|
+
from ..types import Turn
|
|
10
|
+
from ..llm.client import call_llm, get_conversation_model, count_tokens
|
|
11
|
+
|
|
12
|
+
TOKEN_THRESHOLD_RATIO = 0.8
|
|
13
|
+
MAX_CONTEXT_TOKENS = 200_000
|
|
14
|
+
TOKEN_THRESHOLD = int(MAX_CONTEXT_TOKENS * TOKEN_THRESHOLD_RATIO) # 160K
|
|
15
|
+
CHARS_PER_TOKEN = 4
|
|
16
|
+
PRESERVE_RECENT_TURNS = 8
|
|
17
|
+
|
|
18
|
+
SUMMARY_SYSTEM_PROMPT = """You are a precise conversation summarizer. Compress the following debug session turns into a single paragraph that preserves:
|
|
19
|
+
- The developer's key hypotheses (stated and rejected)
|
|
20
|
+
- Observable behaviors (guessing without evidence, checking assumptions, etc.)
|
|
21
|
+
- The current state of understanding at the end of these turns
|
|
22
|
+
- Any files or code elements mentioned
|
|
23
|
+
|
|
24
|
+
Do not editorialize. Do not add new information. Output only the summary paragraph."""
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
@dataclass
|
|
28
|
+
class MessageArray:
|
|
29
|
+
messages: list[dict[str, str]]
|
|
30
|
+
rolling_summary: Optional[str] = None
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def build_message_array(
|
|
34
|
+
turns: list[Turn],
|
|
35
|
+
rolling_summary: Optional[str] = None,
|
|
36
|
+
) -> MessageArray:
|
|
37
|
+
"""Build a message array from turns for LLM input."""
|
|
38
|
+
messages: list[dict[str, str]] = []
|
|
39
|
+
|
|
40
|
+
for turn in turns:
|
|
41
|
+
if turn.question:
|
|
42
|
+
messages.append({"role": "assistant", "content": turn.question})
|
|
43
|
+
if turn.response:
|
|
44
|
+
messages.append({"role": "user", "content": turn.response})
|
|
45
|
+
|
|
46
|
+
return MessageArray(messages=messages, rolling_summary=rolling_summary)
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
def estimate_tokens(
|
|
50
|
+
system_prompt: str,
|
|
51
|
+
messages: list[dict[str, str]],
|
|
52
|
+
) -> int:
|
|
53
|
+
"""Estimate token count from character count (~4 chars per token)."""
|
|
54
|
+
total_chars = len(system_prompt)
|
|
55
|
+
for msg in messages:
|
|
56
|
+
total_chars += len(msg["content"])
|
|
57
|
+
return math.ceil(total_chars / CHARS_PER_TOKEN)
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
def should_summarize(estimated_tokens: int) -> bool:
|
|
61
|
+
"""Determine if the context should be summarized."""
|
|
62
|
+
return estimated_tokens > TOKEN_THRESHOLD
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
async def summarize_old_turns(
|
|
66
|
+
turns: list[Turn],
|
|
67
|
+
existing_summary: Optional[str] = None,
|
|
68
|
+
) -> tuple[str, list[Turn]]:
|
|
69
|
+
"""Summarize older turns, preserving recent ones.
|
|
70
|
+
|
|
71
|
+
Returns (summary, recent_turns).
|
|
72
|
+
"""
|
|
73
|
+
if len(turns) <= PRESERVE_RECENT_TURNS:
|
|
74
|
+
return (existing_summary or "", turns)
|
|
75
|
+
|
|
76
|
+
old_turns = turns[:-PRESERVE_RECENT_TURNS]
|
|
77
|
+
recent_turns = turns[-PRESERVE_RECENT_TURNS:]
|
|
78
|
+
|
|
79
|
+
turns_text = "\n\n".join(
|
|
80
|
+
f"Turn {t.turn_number}:\nQuestion: {t.question}\nDeveloper: {t.response}"
|
|
81
|
+
for t in old_turns
|
|
82
|
+
)
|
|
83
|
+
|
|
84
|
+
if existing_summary:
|
|
85
|
+
to_summarize = (
|
|
86
|
+
f"Previous summary: {existing_summary}\n\n"
|
|
87
|
+
f"New turns to incorporate:\n{turns_text}"
|
|
88
|
+
)
|
|
89
|
+
else:
|
|
90
|
+
to_summarize = turns_text
|
|
91
|
+
|
|
92
|
+
summary = call_llm(
|
|
93
|
+
SUMMARY_SYSTEM_PROMPT,
|
|
94
|
+
[{"role": "user", "content": to_summarize}],
|
|
95
|
+
get_conversation_model(),
|
|
96
|
+
)
|
|
97
|
+
|
|
98
|
+
return (summary, recent_turns)
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
async def check_and_summarize(
|
|
102
|
+
system_prompt: str,
|
|
103
|
+
turns: list[Turn],
|
|
104
|
+
existing_summary: Optional[str] = None,
|
|
105
|
+
) -> tuple[list[Turn], Optional[str]]:
|
|
106
|
+
"""Check context size and summarize if needed.
|
|
107
|
+
|
|
108
|
+
Returns (turns, summary).
|
|
109
|
+
"""
|
|
110
|
+
msg_array = build_message_array(turns, existing_summary)
|
|
111
|
+
estimated = estimate_tokens(system_prompt, msg_array.messages)
|
|
112
|
+
|
|
113
|
+
if not should_summarize(estimated):
|
|
114
|
+
return (turns, existing_summary)
|
|
115
|
+
|
|
116
|
+
# Verify with exact count
|
|
117
|
+
try:
|
|
118
|
+
exact = count_tokens(system_prompt, msg_array.messages, get_conversation_model())
|
|
119
|
+
if exact <= TOKEN_THRESHOLD:
|
|
120
|
+
return (turns, existing_summary)
|
|
121
|
+
except Exception:
|
|
122
|
+
# If count_tokens fails, proceed with summarization based on estimate
|
|
123
|
+
pass
|
|
124
|
+
|
|
125
|
+
summary, recent_turns = await summarize_old_turns(turns, existing_summary)
|
|
126
|
+
return (recent_turns, summary)
|