buildlog 0.1.0__py3-none-any.whl → 0.2.0__py3-none-any.whl
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.
- buildlog/cli.py +46 -23
- buildlog/core/operations.py +11 -15
- buildlog/distill.py +3 -3
- buildlog/embeddings.py +108 -16
- buildlog/mcp/tools.py +4 -4
- buildlog/render/__init__.py +34 -11
- buildlog/render/claude_md.py +3 -24
- buildlog/render/settings_json.py +3 -23
- buildlog/render/skill.py +175 -0
- buildlog/render/tracking.py +43 -0
- buildlog/skills.py +118 -37
- buildlog/stats.py +7 -5
- buildlog-0.2.0.dist-info/METADATA +762 -0
- buildlog-0.2.0.dist-info/RECORD +29 -0
- buildlog-0.1.0.dist-info/METADATA +0 -664
- buildlog-0.1.0.dist-info/RECORD +0 -27
- {buildlog-0.1.0.data → buildlog-0.2.0.data}/data/share/buildlog/copier.yml +0 -0
- {buildlog-0.1.0.data → buildlog-0.2.0.data}/data/share/buildlog/post_gen.py +0 -0
- {buildlog-0.1.0.data → buildlog-0.2.0.data}/data/share/buildlog/template/buildlog/.gitkeep +0 -0
- {buildlog-0.1.0.data → buildlog-0.2.0.data}/data/share/buildlog/template/buildlog/2026-01-01-example.md +0 -0
- {buildlog-0.1.0.data → buildlog-0.2.0.data}/data/share/buildlog/template/buildlog/BUILDLOG_SYSTEM.md +0 -0
- {buildlog-0.1.0.data → buildlog-0.2.0.data}/data/share/buildlog/template/buildlog/_TEMPLATE.md +0 -0
- {buildlog-0.1.0.data → buildlog-0.2.0.data}/data/share/buildlog/template/buildlog/assets/.gitkeep +0 -0
- {buildlog-0.1.0.dist-info → buildlog-0.2.0.dist-info}/WHEEL +0 -0
- {buildlog-0.1.0.dist-info → buildlog-0.2.0.dist-info}/entry_points.txt +0 -0
- {buildlog-0.1.0.dist-info → buildlog-0.2.0.dist-info}/licenses/LICENSE +0 -0
|
@@ -0,0 +1,762 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: buildlog
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: Engineering notebook for AI-assisted development
|
|
5
|
+
Project-URL: Homepage, https://github.com/Peleke/buildlog-template
|
|
6
|
+
Project-URL: Repository, https://github.com/Peleke/buildlog-template
|
|
7
|
+
Author: Peleke Sengstacke
|
|
8
|
+
License-Expression: MIT
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Keywords: ai,buildlog,development,documentation,journal
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: Environment :: Console
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
20
|
+
Classifier: Topic :: Documentation
|
|
21
|
+
Classifier: Topic :: Software Development :: Documentation
|
|
22
|
+
Requires-Python: >=3.10
|
|
23
|
+
Requires-Dist: click>=8.0.0
|
|
24
|
+
Requires-Dist: copier>=9.0.0
|
|
25
|
+
Requires-Dist: numpy>=1.21.0
|
|
26
|
+
Requires-Dist: pyyaml>=6.0.0
|
|
27
|
+
Provides-Extra: all
|
|
28
|
+
Requires-Dist: mcp>=1.0.0; extra == 'all'
|
|
29
|
+
Requires-Dist: openai>=1.0.0; extra == 'all'
|
|
30
|
+
Requires-Dist: sentence-transformers>=2.2.0; extra == 'all'
|
|
31
|
+
Provides-Extra: dev
|
|
32
|
+
Requires-Dist: black>=24.0.0; extra == 'dev'
|
|
33
|
+
Requires-Dist: flake8>=7.0.0; extra == 'dev'
|
|
34
|
+
Requires-Dist: isort>=5.13.0; extra == 'dev'
|
|
35
|
+
Requires-Dist: mypy>=1.8.0; extra == 'dev'
|
|
36
|
+
Requires-Dist: pytest-asyncio>=0.21.0; extra == 'dev'
|
|
37
|
+
Requires-Dist: pytest-cov>=4.0.0; extra == 'dev'
|
|
38
|
+
Requires-Dist: pytest>=7.0.0; extra == 'dev'
|
|
39
|
+
Requires-Dist: types-pyyaml>=6.0.0; extra == 'dev'
|
|
40
|
+
Provides-Extra: embeddings
|
|
41
|
+
Requires-Dist: sentence-transformers>=2.2.0; extra == 'embeddings'
|
|
42
|
+
Provides-Extra: mcp
|
|
43
|
+
Requires-Dist: mcp>=1.0.0; extra == 'mcp'
|
|
44
|
+
Provides-Extra: openai
|
|
45
|
+
Requires-Dist: openai>=1.0.0; extra == 'openai'
|
|
46
|
+
Description-Content-Type: text/markdown
|
|
47
|
+
|
|
48
|
+
<div align="center">
|
|
49
|
+
|
|
50
|
+
# buildlog
|
|
51
|
+
|
|
52
|
+
### Engineering Notebook for AI-Assisted Development
|
|
53
|
+
|
|
54
|
+
[](https://pypi.org/project/buildlog/)
|
|
55
|
+
[](https://python.org/)
|
|
56
|
+
[](https://github.com/Peleke/buildlog-template/actions/workflows/ci.yml)
|
|
57
|
+
[](https://codecov.io/gh/Peleke/buildlog-template)
|
|
58
|
+
[](https://opensource.org/licenses/MIT)
|
|
59
|
+
|
|
60
|
+
**Capture your work as publishable content. Include the fuckups.**
|
|
61
|
+
|
|
62
|
+
<img src="assets/hero3.png" alt="Chaos to Order - buildlog transforms messy development sessions into structured knowledge" width="800"/>
|
|
63
|
+
|
|
64
|
+
[Quick Start](#-quick-start) · [The Pipeline](#-the-pipeline) · [Commands](#-commands) · [Philosophy](#-philosophy)
|
|
65
|
+
|
|
66
|
+
---
|
|
67
|
+
|
|
68
|
+
</div>
|
|
69
|
+
|
|
70
|
+
## The Problem
|
|
71
|
+
|
|
72
|
+
You're pairing with AI on real work. Hours of debugging, wrong turns, "oh shit" moments, and hard-won insights—all vanishing into chat history the moment you close the tab.
|
|
73
|
+
|
|
74
|
+
Meanwhile, your AI agent makes the same mistakes on similar problems because it has no memory of what you learned together.
|
|
75
|
+
|
|
76
|
+
## The Solution
|
|
77
|
+
|
|
78
|
+
**buildlog** captures the signal from AI-assisted development sessions and transforms it into:
|
|
79
|
+
|
|
80
|
+
1. **Publishable content** - Each entry is a $500+ tutorial draft
|
|
81
|
+
2. **Structured insights** - Categorized learnings ready for analysis
|
|
82
|
+
3. **Agent rules** - Deduplicated, confidence-scored rules that improve AI behavior
|
|
83
|
+
|
|
84
|
+
```mermaid
|
|
85
|
+
flowchart LR
|
|
86
|
+
A["Raw Sessions<br/>(ephemeral)"] --> B["Buildlog Entries<br/>(structured markdown)"]
|
|
87
|
+
B --> C["Distilled Insights<br/>(categorized patterns)"]
|
|
88
|
+
C --> D["Agent Rules<br/>(deduplicated + scored)"]
|
|
89
|
+
D --> E["CLAUDE.md<br/>settings.json<br/>Agent Skills"]
|
|
90
|
+
|
|
91
|
+
style A fill:#ff6b6b,color:#fff
|
|
92
|
+
style B fill:#4ecdc4,color:#fff
|
|
93
|
+
style C fill:#45b7d1,color:#fff
|
|
94
|
+
style D fill:#96ceb4,color:#fff
|
|
95
|
+
style E fill:#dda0dd,color:#fff
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
---
|
|
99
|
+
|
|
100
|
+
## Key Concepts
|
|
101
|
+
|
|
102
|
+
| Term | What it means |
|
|
103
|
+
|------|---------------|
|
|
104
|
+
| **Entry** | A structured markdown file documenting one work session |
|
|
105
|
+
| **Insight** | A single learning extracted from an entry's Improvements section |
|
|
106
|
+
| **Pattern** | Raw insights grouped by category (architectural, workflow, etc.) |
|
|
107
|
+
| **Rule** | Deduplicated insight with stable ID, confidence score, and source tracking |
|
|
108
|
+
| **Agent Skill** | Rules promoted to `.claude/skills/` for on-demand loading by Claude |
|
|
109
|
+
|
|
110
|
+
---
|
|
111
|
+
|
|
112
|
+
## Features
|
|
113
|
+
|
|
114
|
+
### Structured Capture
|
|
115
|
+
Templates with six required sections ensure you never forget to document the mistakes that teach the most.
|
|
116
|
+
|
|
117
|
+
### Pattern Distillation
|
|
118
|
+
Extract categorized insights from all your entries into structured JSON/YAML for analysis.
|
|
119
|
+
|
|
120
|
+
### Semantic Deduplication
|
|
121
|
+
"Run tests before commit" and "Always execute the test suite prior to committing" are the same insight. buildlog merges them.
|
|
122
|
+
|
|
123
|
+
### Confidence Scoring
|
|
124
|
+
Rules are scored based on frequency and recency. High-confidence rules have been reinforced multiple times recently.
|
|
125
|
+
|
|
126
|
+
### Multiple Promotion Targets
|
|
127
|
+
Promote rules to CLAUDE.md, settings.json, or **Anthropic Agent Skills** (`.claude/skills/`) for on-demand loading.
|
|
128
|
+
|
|
129
|
+
### Pluggable Embeddings
|
|
130
|
+
Token-based similarity by default. Upgrade to sentence-transformers or OpenAI for semantic understanding.
|
|
131
|
+
|
|
132
|
+
---
|
|
133
|
+
|
|
134
|
+
## Quick Start
|
|
135
|
+
|
|
136
|
+
```bash
|
|
137
|
+
# Install
|
|
138
|
+
pip install buildlog
|
|
139
|
+
|
|
140
|
+
# Initialize in your project
|
|
141
|
+
buildlog init
|
|
142
|
+
|
|
143
|
+
# Create an entry for today's work
|
|
144
|
+
buildlog new auth-api
|
|
145
|
+
|
|
146
|
+
# After a few entries, extract patterns
|
|
147
|
+
buildlog distill
|
|
148
|
+
|
|
149
|
+
# Generate deduplicated rules
|
|
150
|
+
buildlog skills
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
---
|
|
154
|
+
|
|
155
|
+
## The Pipeline
|
|
156
|
+
|
|
157
|
+
buildlog is a three-stage pipeline that transforms ephemeral work into durable knowledge:
|
|
158
|
+
|
|
159
|
+
```mermaid
|
|
160
|
+
flowchart TB
|
|
161
|
+
subgraph Stage1["Stage 1: Capture"]
|
|
162
|
+
A1["buildlog new slug"] --> A2["Edit markdown entry"]
|
|
163
|
+
A2 --> A3["Document: Goal, Journey,<br/>Tests, Code, Improvements"]
|
|
164
|
+
end
|
|
165
|
+
|
|
166
|
+
subgraph Stage2["Stage 2: Distill"]
|
|
167
|
+
B1["buildlog distill"] --> B2["Parse all entries"]
|
|
168
|
+
B2 --> B3["Extract Improvements sections"]
|
|
169
|
+
B3 --> B4["Group by category"]
|
|
170
|
+
end
|
|
171
|
+
|
|
172
|
+
subgraph Stage3["Stage 3: Promote"]
|
|
173
|
+
C1["buildlog skills"] --> C2["Deduplicate similar insights"]
|
|
174
|
+
C2 --> C3["Calculate confidence scores"]
|
|
175
|
+
C3 --> C4["Generate stable IDs"]
|
|
176
|
+
C4 --> C5["Promote to target"]
|
|
177
|
+
end
|
|
178
|
+
|
|
179
|
+
Stage1 --> Stage2 --> Stage3
|
|
180
|
+
|
|
181
|
+
C5 --> D1["CLAUDE.md"]
|
|
182
|
+
C5 --> D2["settings.json"]
|
|
183
|
+
C5 --> D3[".claude/skills/"]
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
### Stage 1: Capture (`buildlog new`)
|
|
187
|
+
|
|
188
|
+
Create structured entries as you work. Each entry has six sections:
|
|
189
|
+
|
|
190
|
+
| Section | Purpose |
|
|
191
|
+
|---------|---------|
|
|
192
|
+
| **The Goal** | What you're building and why |
|
|
193
|
+
| **What We Built** | Architecture diagram, components |
|
|
194
|
+
| **The Journey** | Chronological narrative *including mistakes* |
|
|
195
|
+
| **Test Results** | Actual commands, actual outputs |
|
|
196
|
+
| **Code Samples** | Key snippets with context |
|
|
197
|
+
| **Improvements** | Categorized learnings for next time |
|
|
198
|
+
|
|
199
|
+
The **Improvements** section is structured for machine extraction:
|
|
200
|
+
|
|
201
|
+
```markdown
|
|
202
|
+
### Architectural
|
|
203
|
+
- Always validate inputs at the boundary, not conditionally
|
|
204
|
+
- Use frozen dataclasses for immutable data containers
|
|
205
|
+
|
|
206
|
+
### Workflow
|
|
207
|
+
- Run the test suite after EVERY code change, not just at the end
|
|
208
|
+
- Write the integration test first to clarify the API contract
|
|
209
|
+
|
|
210
|
+
### Tool Usage
|
|
211
|
+
- The `patch` context manager for date mocking is cleaner than fixtures
|
|
212
|
+
- Use `jwt.io` to decode tokens instead of console.log
|
|
213
|
+
|
|
214
|
+
### Domain Knowledge
|
|
215
|
+
- `datetime.utcnow()` is deprecated in Python 3.12+
|
|
216
|
+
- Supabase storage returns 400, not 404, for missing files
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
### Stage 2: Distill (`buildlog distill`)
|
|
220
|
+
|
|
221
|
+
Extract all insights across entries into structured data:
|
|
222
|
+
|
|
223
|
+
```bash
|
|
224
|
+
buildlog distill # JSON to stdout
|
|
225
|
+
buildlog distill -o patterns.yaml # Write to file
|
|
226
|
+
buildlog distill --since 2026-01-01 # Filter by date
|
|
227
|
+
buildlog distill --category workflow # Filter by category
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
Output:
|
|
231
|
+
```json
|
|
232
|
+
{
|
|
233
|
+
"patterns": {
|
|
234
|
+
"architectural": [
|
|
235
|
+
{"insight": "Always validate inputs at boundary...", "source": "2026-01-16-auth.md"}
|
|
236
|
+
],
|
|
237
|
+
"workflow": [...],
|
|
238
|
+
"tool_usage": [...],
|
|
239
|
+
"domain_knowledge": [...]
|
|
240
|
+
},
|
|
241
|
+
"statistics": {
|
|
242
|
+
"total_patterns": 47,
|
|
243
|
+
"by_category": {"architectural": 12, "workflow": 15, ...}
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
### Stage 3: Generate Rules (`buildlog skills`)
|
|
249
|
+
|
|
250
|
+
Transform raw patterns into deduplicated, scored rules:
|
|
251
|
+
|
|
252
|
+
```bash
|
|
253
|
+
buildlog skills # YAML to stdout
|
|
254
|
+
buildlog skills -o rules.yml # Write to file
|
|
255
|
+
buildlog skills --format markdown # For CLAUDE.md injection
|
|
256
|
+
buildlog skills --min-frequency 2 # Only repeated patterns
|
|
257
|
+
buildlog skills --embeddings openai # Semantic deduplication
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
Output:
|
|
261
|
+
```yaml
|
|
262
|
+
generated_at: '2026-01-16T12:00:00Z'
|
|
263
|
+
source_entries: 23
|
|
264
|
+
total_skills: 31
|
|
265
|
+
skills:
|
|
266
|
+
architectural:
|
|
267
|
+
- id: arch-b0fcb62a1e
|
|
268
|
+
rule: Always validate inputs at the boundary, not conditionally
|
|
269
|
+
frequency: 4
|
|
270
|
+
confidence: high
|
|
271
|
+
sources: [auth.md, api.md, validation.md, forms.md]
|
|
272
|
+
tags: [api, error]
|
|
273
|
+
- id: arch-0cda924aeb
|
|
274
|
+
rule: Frozen dataclasses should be the default for data containers
|
|
275
|
+
frequency: 2
|
|
276
|
+
confidence: medium
|
|
277
|
+
sources: [models.md, dto.md]
|
|
278
|
+
tags: [python]
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
---
|
|
282
|
+
|
|
283
|
+
## Patterns vs Rules
|
|
284
|
+
|
|
285
|
+
**Patterns** are raw extractions—every insight from every entry, exactly as written.
|
|
286
|
+
|
|
287
|
+
**Rules** are processed patterns with:
|
|
288
|
+
|
|
289
|
+
| Property | Description |
|
|
290
|
+
|----------|-------------|
|
|
291
|
+
| **Stable ID** | Same rule always gets same ID (SHA-256 based) |
|
|
292
|
+
| **Deduplication** | Similar insights merged, frequency tracked |
|
|
293
|
+
| **Confidence** | high/medium/low based on frequency + recency |
|
|
294
|
+
| **Sources** | Which entries contributed to this rule |
|
|
295
|
+
| **Tags** | Auto-extracted technology/concept keywords |
|
|
296
|
+
|
|
297
|
+
### Deduplication in Action
|
|
298
|
+
|
|
299
|
+
Raw patterns from different entries:
|
|
300
|
+
```
|
|
301
|
+
- "Run tests before committing"
|
|
302
|
+
- "Always run the test suite before commit"
|
|
303
|
+
- "Execute tests prior to committing code"
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
After deduplication → **1 rule** with `frequency: 3`:
|
|
307
|
+
```yaml
|
|
308
|
+
- id: wf-96f12966f1
|
|
309
|
+
rule: Run tests before committing
|
|
310
|
+
frequency: 3
|
|
311
|
+
confidence: high
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
---
|
|
315
|
+
|
|
316
|
+
## Promotion Targets
|
|
317
|
+
|
|
318
|
+
Rules can be promoted to different targets for agent consumption:
|
|
319
|
+
|
|
320
|
+
```mermaid
|
|
321
|
+
flowchart LR
|
|
322
|
+
R["Rules<br/>(buildlog_status)"] --> T1["CLAUDE.md<br/>(append)"]
|
|
323
|
+
R --> T2["settings.json<br/>(merge)"]
|
|
324
|
+
R --> T3[".claude/skills/<br/>(Agent Skill)"]
|
|
325
|
+
|
|
326
|
+
T1 --> A1["Always loaded<br/>in context"]
|
|
327
|
+
T2 --> A2["Project settings<br/>for Claude Code"]
|
|
328
|
+
T3 --> A3["On-demand loading<br/>saves context"]
|
|
329
|
+
|
|
330
|
+
style T3 fill:#96ceb4,color:#fff
|
|
331
|
+
```
|
|
332
|
+
|
|
333
|
+
| Target | File | When to Use |
|
|
334
|
+
|--------|------|-------------|
|
|
335
|
+
| `claude_md` | `CLAUDE.md` | Rules always in context (default) |
|
|
336
|
+
| `settings_json` | `.claude/settings.json` | Project-level Claude Code settings |
|
|
337
|
+
| `skill` | `.claude/skills/buildlog-learned/SKILL.md` | **On-demand loading** - rules load only when relevant |
|
|
338
|
+
|
|
339
|
+
### Anthropic Agent Skills (New!)
|
|
340
|
+
|
|
341
|
+
The `skill` target creates an [Anthropic Agent Skill](https://docs.anthropic.com/en/docs/claude-code/skills) that Claude loads on-demand:
|
|
342
|
+
|
|
343
|
+
```bash
|
|
344
|
+
# Via MCP tool
|
|
345
|
+
buildlog_promote(skill_ids=["arch-123", "wf-456"], target="skill")
|
|
346
|
+
```
|
|
347
|
+
|
|
348
|
+
Creates `.claude/skills/buildlog-learned/SKILL.md`:
|
|
349
|
+
|
|
350
|
+
```markdown
|
|
351
|
+
---
|
|
352
|
+
name: buildlog-learned
|
|
353
|
+
description: Project-specific patterns learned from development history.
|
|
354
|
+
Use when writing code, making architectural decisions, reviewing PRs,
|
|
355
|
+
or ensuring consistency. Contains 12 rules across Architectural, Workflow.
|
|
356
|
+
---
|
|
357
|
+
|
|
358
|
+
# Learned Patterns
|
|
359
|
+
|
|
360
|
+
*12 rules extracted from buildlog entries on 2026-01-16*
|
|
361
|
+
|
|
362
|
+
## Must Follow (High Confidence)
|
|
363
|
+
|
|
364
|
+
These patterns have been reinforced multiple times.
|
|
365
|
+
|
|
366
|
+
### Architectural
|
|
367
|
+
- Always validate inputs at the boundary
|
|
368
|
+
- Use dependency injection for testability
|
|
369
|
+
|
|
370
|
+
### Workflow
|
|
371
|
+
- Run tests after EVERY code change
|
|
372
|
+
|
|
373
|
+
## Should Consider (Medium Confidence)
|
|
374
|
+
|
|
375
|
+
These patterns appear frequently but may have exceptions.
|
|
376
|
+
|
|
377
|
+
### Tool Usage
|
|
378
|
+
- Prefer `patch` context manager for date mocking
|
|
379
|
+
```
|
|
380
|
+
|
|
381
|
+
**Why Agent Skills?**
|
|
382
|
+
- **On-demand loading** - Rules only load when Claude determines they're relevant
|
|
383
|
+
- **Saves context** - Not always in context like CLAUDE.md
|
|
384
|
+
- **Progressive disclosure** - Claude asks before loading the full skill
|
|
385
|
+
|
|
386
|
+
### Live Usage Scenario
|
|
387
|
+
|
|
388
|
+
Here's how your learned rules actually get used:
|
|
389
|
+
|
|
390
|
+
```
|
|
391
|
+
┌─────────────────────────────────────────────────────────────────┐
|
|
392
|
+
│ You: "Review this authentication endpoint I wrote" │
|
|
393
|
+
└─────────────────────────────────────────────────────────────────┘
|
|
394
|
+
│
|
|
395
|
+
▼
|
|
396
|
+
┌─────────────────────────────────────────────────────────────────┐
|
|
397
|
+
│ Claude sees: "authentication" + "review" + "endpoint" │
|
|
398
|
+
│ │
|
|
399
|
+
│ Checks skill description: │
|
|
400
|
+
│ "Use when writing code, making architectural decisions, │
|
|
401
|
+
│ reviewing PRs, or ensuring consistency..." │
|
|
402
|
+
│ │
|
|
403
|
+
│ Match! Loads .claude/skills/buildlog-learned/SKILL.md │
|
|
404
|
+
└─────────────────────────────────────────────────────────────────┘
|
|
405
|
+
│
|
|
406
|
+
▼
|
|
407
|
+
┌─────────────────────────────────────────────────────────────────┐
|
|
408
|
+
│ Claude now has access to YOUR learned rules: │
|
|
409
|
+
│ │
|
|
410
|
+
│ Must Follow: │
|
|
411
|
+
│ - Password hashing belongs in User model, not route handler │
|
|
412
|
+
│ - Always validate inputs at the boundary │
|
|
413
|
+
│ │
|
|
414
|
+
│ Worth Knowing: │
|
|
415
|
+
│ - bcrypt.compare() arg order is (plaintext, hash) │
|
|
416
|
+
│ - JWT expiry is in seconds, not milliseconds │
|
|
417
|
+
└─────────────────────────────────────────────────────────────────┘
|
|
418
|
+
│
|
|
419
|
+
▼
|
|
420
|
+
┌─────────────────────────────────────────────────────────────────┐
|
|
421
|
+
│ Claude: "I notice the password hashing is in your route │
|
|
422
|
+
│ handler. Based on patterns from your buildlog, this should │
|
|
423
|
+
│ be a pre-save hook in the User model instead. │
|
|
424
|
+
│ │
|
|
425
|
+
│ Also, I see bcrypt.compare(hash, password) - the argument │
|
|
426
|
+
│ order should be (plaintext, hash). This has tripped you up │
|
|
427
|
+
│ before." │
|
|
428
|
+
└─────────────────────────────────────────────────────────────────┘
|
|
429
|
+
```
|
|
430
|
+
|
|
431
|
+
Your past mistakes now prevent future ones—automatically.
|
|
432
|
+
|
|
433
|
+
---
|
|
434
|
+
|
|
435
|
+
## Embedding Backends
|
|
436
|
+
|
|
437
|
+
Deduplication uses text similarity. Choose your backend:
|
|
438
|
+
|
|
439
|
+
| Backend | Install | Use Case |
|
|
440
|
+
|---------|---------|----------|
|
|
441
|
+
| `token` (default) | Built-in | Fast, free, good for obvious duplicates |
|
|
442
|
+
| `sentence-transformers` | `pip install buildlog[embeddings]` | Local semantic similarity, no API calls |
|
|
443
|
+
| `openai` | `pip install buildlog[openai]` | Best quality, requires API key |
|
|
444
|
+
|
|
445
|
+
```bash
|
|
446
|
+
# Token-based (default) - catches "run tests" ≈ "run testing"
|
|
447
|
+
buildlog skills
|
|
448
|
+
|
|
449
|
+
# Semantic - catches "use Redis for caching" ≈ "cache data in Redis"
|
|
450
|
+
buildlog skills --embeddings sentence-transformers
|
|
451
|
+
|
|
452
|
+
# OpenAI - best quality semantic matching
|
|
453
|
+
export OPENAI_API_KEY=...
|
|
454
|
+
buildlog skills --embeddings openai
|
|
455
|
+
```
|
|
456
|
+
|
|
457
|
+
### Comparison
|
|
458
|
+
|
|
459
|
+
| Input | Token | OpenAI |
|
|
460
|
+
|-------|:-----:|:------:|
|
|
461
|
+
| "Run tests before commit" ≈ "Run testing before committing" | Merged | Merged |
|
|
462
|
+
| "Use Redis for caching" ≈ "Cache data in Redis" | Separate | Merged |
|
|
463
|
+
|
|
464
|
+
---
|
|
465
|
+
|
|
466
|
+
## Practical Usage
|
|
467
|
+
|
|
468
|
+
### 1. Inject Rules into CLAUDE.md
|
|
469
|
+
|
|
470
|
+
```bash
|
|
471
|
+
buildlog skills --format markdown >> CLAUDE.md
|
|
472
|
+
```
|
|
473
|
+
|
|
474
|
+
Your AI agent now has access to every lesson you've learned:
|
|
475
|
+
|
|
476
|
+
```markdown
|
|
477
|
+
## Learned Rules
|
|
478
|
+
|
|
479
|
+
Based on 23 buildlog entries, 31 actionable rules have emerged:
|
|
480
|
+
|
|
481
|
+
### Architectural (8 rules)
|
|
482
|
+
- Always validate inputs at the boundary (seen 4x)
|
|
483
|
+
- Use frozen dataclasses for data containers (seen 2x)
|
|
484
|
+
|
|
485
|
+
### Workflow (12 rules)
|
|
486
|
+
- Run tests after EVERY code change (seen 5x)
|
|
487
|
+
...
|
|
488
|
+
```
|
|
489
|
+
|
|
490
|
+
### 2. Create an Agent Skill
|
|
491
|
+
|
|
492
|
+
For on-demand loading instead of always-in-context:
|
|
493
|
+
|
|
494
|
+
```bash
|
|
495
|
+
# Via CLI (coming soon)
|
|
496
|
+
buildlog promote --target skill
|
|
497
|
+
|
|
498
|
+
# Via MCP
|
|
499
|
+
buildlog_promote(skill_ids=["arch-123"], target="skill")
|
|
500
|
+
```
|
|
501
|
+
|
|
502
|
+
### 3. Track Rule Evolution
|
|
503
|
+
|
|
504
|
+
Rules have stable IDs. Track which are reinforced over time:
|
|
505
|
+
|
|
506
|
+
```bash
|
|
507
|
+
# This week's new rules
|
|
508
|
+
buildlog skills --since 2026-01-10 -o this-week.yml
|
|
509
|
+
|
|
510
|
+
# Compare to baseline
|
|
511
|
+
diff baseline.yml this-week.yml
|
|
512
|
+
```
|
|
513
|
+
|
|
514
|
+
### 4. Find Your Blind Spots
|
|
515
|
+
|
|
516
|
+
```bash
|
|
517
|
+
buildlog stats --detailed
|
|
518
|
+
```
|
|
519
|
+
|
|
520
|
+
```
|
|
521
|
+
Buildlog Statistics
|
|
522
|
+
|
|
523
|
+
Entries: 23 total
|
|
524
|
+
Coverage: 87% with improvements
|
|
525
|
+
|
|
526
|
+
Category Breakdown:
|
|
527
|
+
architectural: 12 insights (26%)
|
|
528
|
+
workflow: 15 insights (33%)
|
|
529
|
+
tool_usage: 8 insights (17%)
|
|
530
|
+
domain_knowledge: 11 insights (24%)
|
|
531
|
+
|
|
532
|
+
Warnings:
|
|
533
|
+
- 3 entries have empty Improvements sections
|
|
534
|
+
```
|
|
535
|
+
|
|
536
|
+
---
|
|
537
|
+
|
|
538
|
+
## Commands
|
|
539
|
+
|
|
540
|
+
| Command | Description |
|
|
541
|
+
|---------|-------------|
|
|
542
|
+
| `buildlog init` | Initialize in current directory |
|
|
543
|
+
| `buildlog new <slug>` | Create entry for today |
|
|
544
|
+
| `buildlog new <slug> --date 2026-01-15` | Create entry for specific date |
|
|
545
|
+
| `buildlog list` | List all entries |
|
|
546
|
+
| `buildlog distill` | Extract patterns from all entries |
|
|
547
|
+
| `buildlog stats` | Show statistics and analytics |
|
|
548
|
+
| `buildlog skills` | Generate deduplicated rules |
|
|
549
|
+
| `buildlog update` | Update templates to latest |
|
|
550
|
+
|
|
551
|
+
### Skills Options
|
|
552
|
+
|
|
553
|
+
```bash
|
|
554
|
+
--output, -o PATH # Write to file instead of stdout
|
|
555
|
+
--format [yaml|json|markdown] # Output format (default: yaml)
|
|
556
|
+
--min-frequency N # Only rules seen N+ times
|
|
557
|
+
--since YYYY-MM-DD # Only entries from this date
|
|
558
|
+
--embeddings [token|sentence-transformers|openai] # Similarity backend
|
|
559
|
+
```
|
|
560
|
+
|
|
561
|
+
---
|
|
562
|
+
|
|
563
|
+
## Architecture
|
|
564
|
+
|
|
565
|
+
```mermaid
|
|
566
|
+
flowchart TB
|
|
567
|
+
subgraph CLI["CLI Layer"]
|
|
568
|
+
cli["cli.py"]
|
|
569
|
+
end
|
|
570
|
+
|
|
571
|
+
subgraph Core["Core Logic"]
|
|
572
|
+
distill["distill.py<br/>Pattern extraction"]
|
|
573
|
+
skills["skills.py<br/>Deduplication + scoring"]
|
|
574
|
+
stats["stats.py<br/>Analytics"]
|
|
575
|
+
embeddings["embeddings.py<br/>Similarity backends"]
|
|
576
|
+
ops["core/operations.py<br/>status, promote, reject"]
|
|
577
|
+
end
|
|
578
|
+
|
|
579
|
+
subgraph Render["Render Adapters"]
|
|
580
|
+
claude_md["claude_md.py"]
|
|
581
|
+
settings_json["settings_json.py"]
|
|
582
|
+
skill_render["skill.py"]
|
|
583
|
+
end
|
|
584
|
+
|
|
585
|
+
subgraph MCP["MCP Server"]
|
|
586
|
+
server["server.py"]
|
|
587
|
+
tools["tools.py"]
|
|
588
|
+
end
|
|
589
|
+
|
|
590
|
+
cli --> distill
|
|
591
|
+
cli --> skills
|
|
592
|
+
cli --> stats
|
|
593
|
+
|
|
594
|
+
skills --> embeddings
|
|
595
|
+
skills --> distill
|
|
596
|
+
|
|
597
|
+
ops --> skills
|
|
598
|
+
ops --> Render
|
|
599
|
+
|
|
600
|
+
tools --> ops
|
|
601
|
+
server --> tools
|
|
602
|
+
```
|
|
603
|
+
|
|
604
|
+
### Data Flow
|
|
605
|
+
|
|
606
|
+
```mermaid
|
|
607
|
+
flowchart LR
|
|
608
|
+
MD["buildlog/*.md"] --> Parse["Parse markdown"]
|
|
609
|
+
Parse --> Extract["Extract Improvements"]
|
|
610
|
+
Extract --> Distill["distill_all()"]
|
|
611
|
+
Distill --> Patterns["Patterns by category"]
|
|
612
|
+
Patterns --> Dedup["Deduplicate"]
|
|
613
|
+
Dedup --> Score["Calculate confidence"]
|
|
614
|
+
Score --> Rules["Rules with IDs"]
|
|
615
|
+
Rules --> Format["Format output"]
|
|
616
|
+
Format --> Out["YAML / JSON / Markdown / Agent Skill"]
|
|
617
|
+
```
|
|
618
|
+
|
|
619
|
+
---
|
|
620
|
+
|
|
621
|
+
## Installation Options
|
|
622
|
+
|
|
623
|
+
```bash
|
|
624
|
+
# Basic install
|
|
625
|
+
pip install buildlog
|
|
626
|
+
|
|
627
|
+
# With local semantic embeddings (offline)
|
|
628
|
+
pip install buildlog[embeddings]
|
|
629
|
+
|
|
630
|
+
# With OpenAI embeddings
|
|
631
|
+
pip install buildlog[openai]
|
|
632
|
+
|
|
633
|
+
# Everything
|
|
634
|
+
pip install buildlog[all]
|
|
635
|
+
|
|
636
|
+
# Development
|
|
637
|
+
pip install buildlog[dev]
|
|
638
|
+
|
|
639
|
+
# With MCP server for Claude Code integration
|
|
640
|
+
pip install buildlog[mcp]
|
|
641
|
+
```
|
|
642
|
+
|
|
643
|
+
---
|
|
644
|
+
|
|
645
|
+
## MCP Server (Claude Code Integration)
|
|
646
|
+
|
|
647
|
+
The MCP server lets Claude Code interact with your buildlog rules directly. Your agent can review learned patterns, promote them to rules, or reject false positives—all through natural conversation.
|
|
648
|
+
|
|
649
|
+
### Setup for Claude Code CLI
|
|
650
|
+
|
|
651
|
+
1. Install with MCP support:
|
|
652
|
+
```bash
|
|
653
|
+
pip install buildlog[mcp]
|
|
654
|
+
# or with uv
|
|
655
|
+
uv pip install buildlog[mcp]
|
|
656
|
+
```
|
|
657
|
+
|
|
658
|
+
2. Add to your Claude Code settings (`~/.claude/settings.json`):
|
|
659
|
+
```json
|
|
660
|
+
{
|
|
661
|
+
"mcpServers": {
|
|
662
|
+
"buildlog": {
|
|
663
|
+
"command": "buildlog-mcp",
|
|
664
|
+
"args": []
|
|
665
|
+
}
|
|
666
|
+
}
|
|
667
|
+
}
|
|
668
|
+
```
|
|
669
|
+
|
|
670
|
+
3. Start a new Claude Code session. The buildlog tools will be available.
|
|
671
|
+
|
|
672
|
+
### Available Tools
|
|
673
|
+
|
|
674
|
+
| Tool | Description |
|
|
675
|
+
|------|-------------|
|
|
676
|
+
| `buildlog_status` | Get rules grouped by category with confidence scores |
|
|
677
|
+
| `buildlog_promote` | Write rules to CLAUDE.md, settings.json, or **Agent Skills** |
|
|
678
|
+
| `buildlog_reject` | Mark rules to exclude from future suggestions |
|
|
679
|
+
| `buildlog_diff` | Show rules pending review (not yet promoted/rejected) |
|
|
680
|
+
|
|
681
|
+
### Promotion Targets via MCP
|
|
682
|
+
|
|
683
|
+
```python
|
|
684
|
+
# Append to CLAUDE.md (default)
|
|
685
|
+
buildlog_promote(skill_ids=["arch-123"], target="claude_md")
|
|
686
|
+
|
|
687
|
+
# Merge into settings.json
|
|
688
|
+
buildlog_promote(skill_ids=["arch-123"], target="settings_json")
|
|
689
|
+
|
|
690
|
+
# Create Anthropic Agent Skill (NEW!)
|
|
691
|
+
buildlog_promote(skill_ids=["arch-123"], target="skill")
|
|
692
|
+
```
|
|
693
|
+
|
|
694
|
+
### Example Conversation
|
|
695
|
+
|
|
696
|
+
```
|
|
697
|
+
You: What patterns have I learned?
|
|
698
|
+
|
|
699
|
+
Claude: [calls buildlog_status]
|
|
700
|
+
Based on 23 buildlog entries, you have 31 rules:
|
|
701
|
+
|
|
702
|
+
High confidence (ready to promote):
|
|
703
|
+
- arch-b0fcb62a1e: "Always validate inputs at the boundary"
|
|
704
|
+
- wf-96f12966f1: "Run tests before committing"
|
|
705
|
+
|
|
706
|
+
Would you like me to add these to your CLAUDE.md or create an Agent Skill?
|
|
707
|
+
|
|
708
|
+
You: Create an Agent Skill so they load on-demand.
|
|
709
|
+
|
|
710
|
+
Claude: [calls buildlog_promote with target="skill"]
|
|
711
|
+
Created skill at .claude/skills/buildlog-learned/SKILL.md
|
|
712
|
+
|
|
713
|
+
This skill will load on-demand when relevant to your work,
|
|
714
|
+
saving context for when you need it most.
|
|
715
|
+
```
|
|
716
|
+
|
|
717
|
+
---
|
|
718
|
+
|
|
719
|
+
## Philosophy
|
|
720
|
+
|
|
721
|
+
### 1. Write Fast, Not Pretty
|
|
722
|
+
Refrigerator to-do list energy. Get it down before you forget.
|
|
723
|
+
|
|
724
|
+
### 2. Never Delete Mistakes
|
|
725
|
+
Wrong turns are the most valuable content. They're what makes tutorials actually useful.
|
|
726
|
+
|
|
727
|
+
### 3. Include the Journey
|
|
728
|
+
"We tried X, it failed because Y, so we did Z" > "We did Z"
|
|
729
|
+
|
|
730
|
+
### 4. Capture Improvements
|
|
731
|
+
Concrete learnings, not vague observations. "Always validate at boundary" > "validation is important"
|
|
732
|
+
|
|
733
|
+
### 5. Quality Bar
|
|
734
|
+
Each entry should be publishable as a **$500+ tutorial**. Real error messages. Honest about what didn't work. Code that runs.
|
|
735
|
+
|
|
736
|
+
---
|
|
737
|
+
|
|
738
|
+
## Contributing
|
|
739
|
+
|
|
740
|
+
1. Fork the repository
|
|
741
|
+
2. Create a feature branch (`git checkout -b feature/amazing`)
|
|
742
|
+
3. Commit your changes (`git commit -m 'Add amazing feature'`)
|
|
743
|
+
4. Push to the branch (`git push origin feature/amazing`)
|
|
744
|
+
5. Open a Pull Request
|
|
745
|
+
|
|
746
|
+
---
|
|
747
|
+
|
|
748
|
+
## License
|
|
749
|
+
|
|
750
|
+
MIT License — see [LICENSE](./LICENSE) for details.
|
|
751
|
+
|
|
752
|
+
---
|
|
753
|
+
|
|
754
|
+
<div align="center">
|
|
755
|
+
|
|
756
|
+
**Your AI pair programmer should learn from your mistakes.**
|
|
757
|
+
|
|
758
|
+
**buildlog makes that possible.**
|
|
759
|
+
|
|
760
|
+
[Back to top](#buildlog)
|
|
761
|
+
|
|
762
|
+
</div>
|