@redaksjon/protokoll 0.0.7 → 0.0.9
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.
- package/.cursor/rules/definition-of-done.md +89 -0
- package/.cursor/rules/no-emoticons.md +43 -0
- package/LICENSE +1 -1
- package/README.md +928 -35
- package/dist/agentic/executor.js +315 -0
- package/dist/agentic/executor.js.map +1 -0
- package/dist/agentic/index.js +19 -0
- package/dist/agentic/index.js.map +1 -0
- package/dist/agentic/registry.js +41 -0
- package/dist/agentic/registry.js.map +1 -0
- package/dist/agentic/tools/lookup-person.js +66 -0
- package/dist/agentic/tools/lookup-person.js.map +1 -0
- package/dist/agentic/tools/lookup-project.js +93 -0
- package/dist/agentic/tools/lookup-project.js.map +1 -0
- package/dist/agentic/tools/route-note.js +45 -0
- package/dist/agentic/tools/route-note.js.map +1 -0
- package/dist/agentic/tools/store-context.js +51 -0
- package/dist/agentic/tools/store-context.js.map +1 -0
- package/dist/agentic/tools/verify-spelling.js +57 -0
- package/dist/agentic/tools/verify-spelling.js.map +1 -0
- package/dist/arguments.js +23 -6
- package/dist/arguments.js.map +1 -1
- package/dist/constants.js +13 -11
- package/dist/constants.js.map +1 -1
- package/dist/context/discovery.js +114 -0
- package/dist/context/discovery.js.map +1 -0
- package/dist/context/index.js +58 -0
- package/dist/context/index.js.map +1 -0
- package/dist/context/storage.js +131 -0
- package/dist/context/storage.js.map +1 -0
- package/dist/interactive/handler.js +223 -0
- package/dist/interactive/handler.js.map +1 -0
- package/dist/interactive/index.js +18 -0
- package/dist/interactive/index.js.map +1 -0
- package/dist/interactive/onboarding.js +28 -0
- package/dist/interactive/onboarding.js.map +1 -0
- package/dist/main.js +0 -0
- package/dist/output/index.js +8 -0
- package/dist/output/index.js.map +1 -0
- package/dist/output/manager.js +105 -0
- package/dist/output/manager.js.map +1 -0
- package/dist/phases/complete.js +107 -0
- package/dist/phases/complete.js.map +1 -0
- package/dist/phases/locate.js +14 -5
- package/dist/phases/locate.js.map +1 -1
- package/dist/pipeline/index.js +8 -0
- package/dist/pipeline/index.js.map +1 -0
- package/dist/pipeline/orchestrator.js +281 -0
- package/dist/pipeline/orchestrator.js.map +1 -0
- package/dist/prompt/instructions/transcribe.md +6 -6
- package/dist/prompt/personas/transcriber.md +5 -5
- package/dist/protokoll.js +38 -5
- package/dist/protokoll.js.map +1 -1
- package/dist/reasoning/client.js +150 -0
- package/dist/reasoning/client.js.map +1 -0
- package/dist/reasoning/index.js +36 -0
- package/dist/reasoning/index.js.map +1 -0
- package/dist/reasoning/strategy.js +60 -0
- package/dist/reasoning/strategy.js.map +1 -0
- package/dist/reflection/collector.js +124 -0
- package/dist/reflection/collector.js.map +1 -0
- package/dist/reflection/index.js +16 -0
- package/dist/reflection/index.js.map +1 -0
- package/dist/reflection/reporter.js +238 -0
- package/dist/reflection/reporter.js.map +1 -0
- package/dist/routing/classifier.js +201 -0
- package/dist/routing/classifier.js.map +1 -0
- package/dist/routing/index.js +27 -0
- package/dist/routing/index.js.map +1 -0
- package/dist/routing/router.js +153 -0
- package/dist/routing/router.js.map +1 -0
- package/dist/transcription/index.js +41 -0
- package/dist/transcription/index.js.map +1 -0
- package/dist/transcription/service.js +64 -0
- package/dist/transcription/service.js.map +1 -0
- package/dist/transcription/types.js +31 -0
- package/dist/transcription/types.js.map +1 -0
- package/dist/util/media.js +4 -4
- package/dist/util/media.js.map +1 -1
- package/dist/util/metadata.js +95 -0
- package/dist/util/metadata.js.map +1 -0
- package/dist/util/storage.js +2 -2
- package/dist/util/storage.js.map +1 -1
- package/docs/examples.md +224 -0
- package/docs/index.html +5 -3
- package/docs/package-lock.json +639 -332
- package/docs/package.json +5 -4
- package/docs/troubleshooting.md +257 -0
- package/docs/vite.config.js +9 -3
- package/eslint.config.mjs +1 -0
- package/guide/architecture.md +217 -0
- package/guide/configuration.md +199 -0
- package/guide/context-system.md +215 -0
- package/guide/development.md +273 -0
- package/guide/index.md +91 -0
- package/guide/interactive.md +199 -0
- package/guide/quickstart.md +138 -0
- package/guide/reasoning.md +193 -0
- package/guide/routing.md +222 -0
- package/package.json +79 -76
- package/tsconfig.tsbuildinfo +1 -1
- package/vitest.config.ts +27 -5
- package/dist/phases/transcribe.js +0 -149
- package/dist/phases/transcribe.js.map +0 -1
- package/dist/processor.js +0 -35
- package/dist/processor.js.map +0 -1
- package/dist/prompt/transcribe.js +0 -41
- package/dist/prompt/transcribe.js.map +0 -1
- package/dist/util/general.js +0 -39
- package/dist/util/general.js.map +0 -1
- package/dist/util/openai.js +0 -92
- package/dist/util/openai.js.map +0 -1
- package/output/kodrdriv/250702-1905-commit-message.md +0 -1
- package/output/kodrdriv/250702-1905-commit.request.json +0 -14
- package/output/kodrdriv/250702-1905-commit.response.json +0 -36
- package/output/kodrdriv/250702-1906-commit-message.md +0 -1
- package/output/kodrdriv/250702-1907-commit-message.md +0 -1
- package/output/kodrdriv/250702-1907-commit.request.json +0 -14
- package/output/kodrdriv/250702-1907-commit.response.json +0 -36
- package/output/kodrdriv/250716-1517-review-analysis.md +0 -39
- package/output/kodrdriv/250716-1517-review-notes.md +0 -69
- package/output/kodrdriv/250716-1518-review-analysis.md +0 -15
- package/output/kodrdriv/250716-1518-review-notes.md +0 -67
- package/output/kodrdriv/250716-1523-review-analysis.md +0 -36
- package/output/kodrdriv/250716-1523-review-notes.md +0 -87
- package/output/kodrdriv/250722-1135-commit-message.md +0 -1
- package/output/kodrdriv/250722-1331-commit-message.md +0 -1
- package/output/kodrdriv/250722-1335-commit-message.md +0 -1
- package/output/kodrdriv/250722-1337-commit-message.md +0 -1
- package/output/kodrdriv/250722-1342-release-notes.md +0 -26
- package/output/kodrdriv/250722-1416-commit-message.md +0 -3
- package/output/kodrdriv/250722-1420-commit-message.md +0 -1
- package/output/kodrdriv/250722-1422-commit-message.md +0 -1
- package/output/kodrdriv/250722-1423-commit-message.md +0 -1
- package/output/kodrdriv/250722-1425-release-notes.md +0 -41
- package/output/kodrdriv/250722-1527-commit-message.md +0 -13
- package/output/kodrdriv/250722-1532-commit-message.md +0 -1
- package/output/kodrdriv/250722-1532-release-notes.md +0 -32
- package/output/kodrdriv/250722-2314-review-analysis.md +0 -28
- package/output/kodrdriv/250722-2314-review-notes.md +0 -464
- package/output/kodrdriv/250722-2315-review-analysis.md +0 -28
- package/output/kodrdriv/250722-2315-review-notes.md +0 -477
- package/output/kodrdriv/250804-1623-review-analysis.md +0 -38
- package/output/kodrdriv/250804-1623-review-notes.md +0 -479
- package/output/kodrdriv/250804-1638-review-analysis.md +0 -56
- package/output/kodrdriv/250804-1638-review-notes.md +0 -502
- package/output/kodrdriv/250812-2021-review-analysis.md +0 -27
- package/output/kodrdriv/250812-2021-review-notes.md +0 -571
- package/output/kodrdriv/250826-0700-commit-message.md +0 -12
- package/output/kodrdriv/RELEASE_NOTES.md +0 -30
- package/output/kodrdriv/RELEASE_TITLE.md +0 -1
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
# Configuration Guide
|
|
2
|
+
|
|
3
|
+
## Configuration Files
|
|
4
|
+
|
|
5
|
+
### Main Config: `~/.protokoll/config.yaml`
|
|
6
|
+
|
|
7
|
+
```yaml
|
|
8
|
+
# Model settings
|
|
9
|
+
model: "gpt-5.2" # Reasoning model (default)
|
|
10
|
+
transcriptionModel: "whisper-1" # Audio transcription
|
|
11
|
+
|
|
12
|
+
# Context
|
|
13
|
+
context:
|
|
14
|
+
directory: "~/.protokoll"
|
|
15
|
+
autoCreate: true
|
|
16
|
+
|
|
17
|
+
# Routing
|
|
18
|
+
routing:
|
|
19
|
+
default:
|
|
20
|
+
path: "~/notes"
|
|
21
|
+
structure: "month"
|
|
22
|
+
filename:
|
|
23
|
+
- date
|
|
24
|
+
- time
|
|
25
|
+
- subject
|
|
26
|
+
|
|
27
|
+
projects:
|
|
28
|
+
- projectId: "work"
|
|
29
|
+
destination:
|
|
30
|
+
path: "~/work/notes"
|
|
31
|
+
structure: "month"
|
|
32
|
+
triggers:
|
|
33
|
+
- "work note"
|
|
34
|
+
- "about work"
|
|
35
|
+
|
|
36
|
+
# Output
|
|
37
|
+
output:
|
|
38
|
+
intermediateDir: "./output/protokoll"
|
|
39
|
+
keepIntermediates: true
|
|
40
|
+
|
|
41
|
+
# Features
|
|
42
|
+
features:
|
|
43
|
+
interactive: false # Disabled by default
|
|
44
|
+
selfReflection: true # Enabled by default
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Environment Variables
|
|
48
|
+
|
|
49
|
+
| Variable | Description |
|
|
50
|
+
|----------|-------------|
|
|
51
|
+
| `OPENAI_API_KEY` | OpenAI API key (required) |
|
|
52
|
+
| `ANTHROPIC_API_KEY` | Anthropic API key (for Claude models) |
|
|
53
|
+
| `PROTOKOLL_MODEL` | Override default model |
|
|
54
|
+
| `PROTOKOLL_CONFIG_DIR` | Config directory |
|
|
55
|
+
|
|
56
|
+
## Command Line Options
|
|
57
|
+
|
|
58
|
+
### Basic Options
|
|
59
|
+
|
|
60
|
+
| Option | Description | Default |
|
|
61
|
+
|--------|-------------|---------|
|
|
62
|
+
| `--input-directory <dir>` | Directory with audio files | Required |
|
|
63
|
+
| `--output-directory <dir>` | Default output directory | `~/notes` |
|
|
64
|
+
| `--model <model>` | Reasoning model | `gpt-5.2` |
|
|
65
|
+
| `--transcription-model <model>` | Whisper model | `whisper-1` |
|
|
66
|
+
|
|
67
|
+
### Mode Options
|
|
68
|
+
|
|
69
|
+
| Option | Description | Default |
|
|
70
|
+
|--------|-------------|---------|
|
|
71
|
+
| `--interactive` | Enable interactive clarifications | `false` |
|
|
72
|
+
| `--self-reflection` | Generate reflection reports | `true` |
|
|
73
|
+
| `--no-self-reflection` | Disable reflection reports | - |
|
|
74
|
+
| `--dry-run` | Show what would happen | `false` |
|
|
75
|
+
| `--verbose` | Enable verbose logging | `false` |
|
|
76
|
+
| `--debug` | Enable debug mode | `false` |
|
|
77
|
+
|
|
78
|
+
### Advanced Options
|
|
79
|
+
|
|
80
|
+
| Option | Description | Default |
|
|
81
|
+
|--------|-------------|---------|
|
|
82
|
+
| `--context-directories <dirs...>` | Additional context locations | `[]` |
|
|
83
|
+
| `--max-audio-size <bytes>` | Maximum audio file size | `26214400` (25MB) |
|
|
84
|
+
| `--temp-directory <dir>` | Temporary file storage | OS temp dir |
|
|
85
|
+
| `--processed-directory <dir>` | Move processed files here | - |
|
|
86
|
+
| `--overrides` | Allow config overrides | `false` |
|
|
87
|
+
|
|
88
|
+
## Routing Structures
|
|
89
|
+
|
|
90
|
+
Protokoll uses Dreadcabinet structure codenames:
|
|
91
|
+
|
|
92
|
+
| Structure | Example Path |
|
|
93
|
+
|-----------|--------------|
|
|
94
|
+
| `none` | `notes/meeting.md` |
|
|
95
|
+
| `year` | `notes/2026/meeting.md` |
|
|
96
|
+
| `month` | `notes/2026/01/meeting.md` |
|
|
97
|
+
| `day` | `notes/2026/01/11/meeting.md` |
|
|
98
|
+
|
|
99
|
+
## Filename Options
|
|
100
|
+
|
|
101
|
+
| Option | Example |
|
|
102
|
+
|--------|---------|
|
|
103
|
+
| `date` | `260111` (YYMMDD format) |
|
|
104
|
+
| `time` | `1430` (HHmm format) |
|
|
105
|
+
| `subject` | `meeting-notes` |
|
|
106
|
+
|
|
107
|
+
Combined: `260111-1430-meeting-notes.md`
|
|
108
|
+
|
|
109
|
+
## Hierarchical Configuration
|
|
110
|
+
|
|
111
|
+
Protokoll walks up the directory tree looking for `.protokoll/` directories:
|
|
112
|
+
|
|
113
|
+
```
|
|
114
|
+
~/work/project-a/recordings/
|
|
115
|
+
↓ looks for .protokoll/ in:
|
|
116
|
+
~/work/project-a/.protokoll/ # Project-specific
|
|
117
|
+
~/work/.protokoll/ # Work-specific
|
|
118
|
+
~/.protokoll/ # Global
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
Lower directories take precedence for conflicting settings.
|
|
122
|
+
|
|
123
|
+
## Model Selection
|
|
124
|
+
|
|
125
|
+
### Reasoning Models
|
|
126
|
+
|
|
127
|
+
| Model | Provider | Notes |
|
|
128
|
+
|-------|----------|-------|
|
|
129
|
+
| `gpt-5.2` | OpenAI | **Default** - High reasoning capability |
|
|
130
|
+
| `gpt-5.1` | OpenAI | High reasoning, balanced |
|
|
131
|
+
| `gpt-5` | OpenAI | Fast and capable |
|
|
132
|
+
| `gpt-4o` | OpenAI | Previous gen, still capable |
|
|
133
|
+
| `gpt-4o-mini` | OpenAI | Fast, lower cost |
|
|
134
|
+
| `o1` | OpenAI | Reasoning-focused |
|
|
135
|
+
| `o1-mini` | OpenAI | Faster reasoning |
|
|
136
|
+
| `claude-3-5-sonnet` | Anthropic | Recommended for complex transcripts |
|
|
137
|
+
| `claude-3-opus` | Anthropic | Highest capability |
|
|
138
|
+
| `claude-3-haiku` | Anthropic | Fast, cost-effective |
|
|
139
|
+
|
|
140
|
+
### Transcription Models
|
|
141
|
+
|
|
142
|
+
| Model | Notes |
|
|
143
|
+
|-------|-------|
|
|
144
|
+
| `whisper-1` | Standard Whisper (default) |
|
|
145
|
+
| `gpt-4o-transcribe` | Newer model with prompting support |
|
|
146
|
+
|
|
147
|
+
> **Note**: Protokoll accepts any model string without restrictions. Model validation happens at the API level, ensuring future compatibility.
|
|
148
|
+
|
|
149
|
+
## Example Configurations
|
|
150
|
+
|
|
151
|
+
### Personal Notes
|
|
152
|
+
|
|
153
|
+
```yaml
|
|
154
|
+
model: "gpt-5.2"
|
|
155
|
+
routing:
|
|
156
|
+
default:
|
|
157
|
+
path: "~/notes"
|
|
158
|
+
structure: "month"
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
### Work Projects
|
|
162
|
+
|
|
163
|
+
```yaml
|
|
164
|
+
model: "claude-3-5-sonnet"
|
|
165
|
+
routing:
|
|
166
|
+
default:
|
|
167
|
+
path: "~/notes/personal"
|
|
168
|
+
structure: "month"
|
|
169
|
+
projects:
|
|
170
|
+
- projectId: "work"
|
|
171
|
+
destination:
|
|
172
|
+
path: "~/work/notes"
|
|
173
|
+
structure: "day"
|
|
174
|
+
triggers:
|
|
175
|
+
- "work"
|
|
176
|
+
- "office"
|
|
177
|
+
- "meeting"
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
### Team Shared Context
|
|
181
|
+
|
|
182
|
+
```yaml
|
|
183
|
+
# ~/team-project/.protokoll/config.yaml
|
|
184
|
+
context:
|
|
185
|
+
directory: "./.protokoll"
|
|
186
|
+
routing:
|
|
187
|
+
default:
|
|
188
|
+
path: "./notes"
|
|
189
|
+
structure: "month"
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
### Batch Processing (No Self-Reflection)
|
|
193
|
+
|
|
194
|
+
```yaml
|
|
195
|
+
features:
|
|
196
|
+
selfReflection: false
|
|
197
|
+
interactive: false
|
|
198
|
+
```
|
|
199
|
+
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
# Context System
|
|
2
|
+
|
|
3
|
+
The context system is Protokoll's knowledge base for improving transcription accuracy.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
Protokoll uses hierarchical configuration discovery to find context:
|
|
8
|
+
|
|
9
|
+
1. Walks up directory tree from input location
|
|
10
|
+
2. Finds all `.protokoll/` directories
|
|
11
|
+
3. Merges context with local taking precedence
|
|
12
|
+
|
|
13
|
+
## Directory Structure
|
|
14
|
+
|
|
15
|
+
```
|
|
16
|
+
~/.protokoll/
|
|
17
|
+
├── config.yaml # Main configuration
|
|
18
|
+
├── people/ # Person definitions
|
|
19
|
+
│ └── *.yaml
|
|
20
|
+
├── projects/ # Project definitions
|
|
21
|
+
│ └── *.yaml
|
|
22
|
+
├── companies/ # Company definitions
|
|
23
|
+
│ └── *.yaml
|
|
24
|
+
└── terms/ # Terminology definitions
|
|
25
|
+
└── *.yaml
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Entity Types
|
|
29
|
+
|
|
30
|
+
### People
|
|
31
|
+
|
|
32
|
+
```yaml
|
|
33
|
+
# ~/.protokoll/people/priya-sharma.yaml
|
|
34
|
+
id: priya-sharma
|
|
35
|
+
name: Priya Sharma
|
|
36
|
+
firstName: Priya
|
|
37
|
+
lastName: Sharma
|
|
38
|
+
company: acme-corp
|
|
39
|
+
role: Engineering Manager
|
|
40
|
+
sounds_like:
|
|
41
|
+
- "pre a"
|
|
42
|
+
- "pria"
|
|
43
|
+
- "preeya sharma"
|
|
44
|
+
context: "Colleague from engineering team"
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### Projects
|
|
48
|
+
|
|
49
|
+
```yaml
|
|
50
|
+
# ~/.protokoll/projects/quarterly-planning.yaml
|
|
51
|
+
id: quarterly-planning
|
|
52
|
+
name: Quarterly Planning
|
|
53
|
+
category: work
|
|
54
|
+
destination: "~/work/planning/notes"
|
|
55
|
+
structure: "month"
|
|
56
|
+
triggers:
|
|
57
|
+
- "quarterly planning"
|
|
58
|
+
- "Q1 planning"
|
|
59
|
+
- "Q2 planning"
|
|
60
|
+
active: true
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### Companies
|
|
64
|
+
|
|
65
|
+
```yaml
|
|
66
|
+
# ~/.protokoll/companies/acme-corp.yaml
|
|
67
|
+
id: acme-corp
|
|
68
|
+
name: Acme Corporation
|
|
69
|
+
sounds_like:
|
|
70
|
+
- "acme"
|
|
71
|
+
- "acme corp"
|
|
72
|
+
- "a.c.m.e."
|
|
73
|
+
context: "Client company in manufacturing"
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### Terms
|
|
77
|
+
|
|
78
|
+
```yaml
|
|
79
|
+
# ~/.protokoll/terms/kubernetes.yaml
|
|
80
|
+
id: kubernetes
|
|
81
|
+
term: Kubernetes
|
|
82
|
+
sounds_like:
|
|
83
|
+
- "kube"
|
|
84
|
+
- "k8s"
|
|
85
|
+
- "kuber netties"
|
|
86
|
+
- "kubernetes"
|
|
87
|
+
context: "Container orchestration platform"
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
## Phonetic Aliases (sounds_like)
|
|
91
|
+
|
|
92
|
+
The `sounds_like` field maps common mishearings to correct spellings:
|
|
93
|
+
|
|
94
|
+
```yaml
|
|
95
|
+
sounds_like:
|
|
96
|
+
- "pre a" # Whisper might hear "Priya" as "pre a"
|
|
97
|
+
- "pria" # Or as "pria"
|
|
98
|
+
- "preeya" # Or as "preeya"
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
When Protokoll sees any of these in a transcript, it knows to correct them.
|
|
102
|
+
|
|
103
|
+
## Hierarchical Discovery
|
|
104
|
+
|
|
105
|
+
Context is discovered by walking up the directory tree:
|
|
106
|
+
|
|
107
|
+
```
|
|
108
|
+
~/work/project-a/recordings/audio.m4a
|
|
109
|
+
↓
|
|
110
|
+
~/work/project-a/.protokoll/ # Project-specific context
|
|
111
|
+
~/work/.protokoll/ # Work-specific context
|
|
112
|
+
~/.protokoll/ # Global context
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### Merge Behavior
|
|
116
|
+
|
|
117
|
+
- **People, Companies, Terms**: All are loaded, local IDs override global
|
|
118
|
+
- **Projects**: All are loaded, local definitions take precedence
|
|
119
|
+
- **Config**: Deep merged, local settings override global
|
|
120
|
+
|
|
121
|
+
## API
|
|
122
|
+
|
|
123
|
+
### ContextInstance
|
|
124
|
+
|
|
125
|
+
```typescript
|
|
126
|
+
interface ContextInstance {
|
|
127
|
+
// Get merged configuration
|
|
128
|
+
getConfig(): HierarchicalConfig;
|
|
129
|
+
|
|
130
|
+
// Entity lookup
|
|
131
|
+
getPerson(id: string): Person | undefined;
|
|
132
|
+
getProject(id: string): Project | undefined;
|
|
133
|
+
getCompany(id: string): Company | undefined;
|
|
134
|
+
getTerm(id: string): Term | undefined;
|
|
135
|
+
|
|
136
|
+
// Get all entities
|
|
137
|
+
getAllPeople(): Person[];
|
|
138
|
+
getAllProjects(): Project[];
|
|
139
|
+
getAllCompanies(): Company[];
|
|
140
|
+
getAllTerms(): Term[];
|
|
141
|
+
|
|
142
|
+
// Phonetic lookup
|
|
143
|
+
findByPhonetic(sounds_like: string): Entity | undefined;
|
|
144
|
+
|
|
145
|
+
// State
|
|
146
|
+
hasContext(): boolean;
|
|
147
|
+
|
|
148
|
+
// Persistence
|
|
149
|
+
savePerson(person: Person): Promise<void>;
|
|
150
|
+
saveProject(project: Project): Promise<void>;
|
|
151
|
+
}
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
## Usage in Agentic Tools
|
|
155
|
+
|
|
156
|
+
### lookup_person
|
|
157
|
+
|
|
158
|
+
```typescript
|
|
159
|
+
// Tool looks up person by name or phonetic
|
|
160
|
+
const person = context.findByPhonetic("pre a");
|
|
161
|
+
// Returns: { id: "priya-sharma", name: "Priya Sharma", ... }
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
### lookup_project
|
|
165
|
+
|
|
166
|
+
```typescript
|
|
167
|
+
// Tool finds project by trigger phrase
|
|
168
|
+
const projects = context.getAllProjects();
|
|
169
|
+
const match = projects.find(p =>
|
|
170
|
+
p.triggers?.some(t => text.toLowerCase().includes(t))
|
|
171
|
+
);
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
### store_context
|
|
175
|
+
|
|
176
|
+
```typescript
|
|
177
|
+
// Tool saves new person to context
|
|
178
|
+
await context.savePerson({
|
|
179
|
+
id: "new-person",
|
|
180
|
+
name: "New Person",
|
|
181
|
+
sounds_like: ["new per son"]
|
|
182
|
+
});
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
## Best Practices
|
|
186
|
+
|
|
187
|
+
1. **Use descriptive IDs**: `priya-sharma` not `person1`
|
|
188
|
+
2. **Add multiple sounds_like**: Cover common mishearings
|
|
189
|
+
3. **Include context**: Helps with disambiguation
|
|
190
|
+
4. **Organize by project**: Use project-specific `.protokoll/` directories
|
|
191
|
+
5. **Keep global context minimal**: Only truly global entities
|
|
192
|
+
|
|
193
|
+
## Troubleshooting
|
|
194
|
+
|
|
195
|
+
### Context Not Found
|
|
196
|
+
|
|
197
|
+
```bash
|
|
198
|
+
# Check discovery with verbose mode
|
|
199
|
+
protokoll --verbose --input-directory ./recordings
|
|
200
|
+
|
|
201
|
+
# Look for: "Found .protokoll at: ..."
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
### Wrong Entity Matched
|
|
205
|
+
|
|
206
|
+
1. Check `sounds_like` for conflicts
|
|
207
|
+
2. Add more specific phonetic patterns
|
|
208
|
+
3. Use `--debug` to see matching decisions
|
|
209
|
+
|
|
210
|
+
### Performance Issues
|
|
211
|
+
|
|
212
|
+
1. Keep context files small
|
|
213
|
+
2. Use project-specific context
|
|
214
|
+
3. Avoid duplicate entries
|
|
215
|
+
|
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
# Development Guide
|
|
2
|
+
|
|
3
|
+
Guide for developing and extending Protokoll.
|
|
4
|
+
|
|
5
|
+
## Setup
|
|
6
|
+
|
|
7
|
+
### Prerequisites
|
|
8
|
+
|
|
9
|
+
- Node.js 18+
|
|
10
|
+
- npm 9+
|
|
11
|
+
|
|
12
|
+
### Clone and Install
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
git clone https://github.com/redaksjon/protokoll.git
|
|
16
|
+
cd protokoll
|
|
17
|
+
npm install
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
### Build
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
npm run build
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### Test
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
npm test
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### Lint
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
npm run lint
|
|
36
|
+
npm run lint:fix # Auto-fix issues
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Project Structure
|
|
40
|
+
|
|
41
|
+
```
|
|
42
|
+
protokoll/
|
|
43
|
+
├── src/
|
|
44
|
+
│ ├── agentic/ # Agentic tool system
|
|
45
|
+
│ │ ├── tools/ # Individual tools
|
|
46
|
+
│ │ │ ├── lookup-person.ts
|
|
47
|
+
│ │ │ ├── lookup-project.ts
|
|
48
|
+
│ │ │ ├── route-note.ts
|
|
49
|
+
│ │ │ ├── store-context.ts
|
|
50
|
+
│ │ │ └── verify-spelling.ts
|
|
51
|
+
│ │ ├── registry.ts # Tool registry
|
|
52
|
+
│ │ ├── executor.ts # Execution loop
|
|
53
|
+
│ │ └── types.ts
|
|
54
|
+
│ ├── context/ # Context system
|
|
55
|
+
│ │ ├── discovery.ts # Hierarchical discovery
|
|
56
|
+
│ │ ├── storage.ts # Entity storage
|
|
57
|
+
│ │ └── types.ts
|
|
58
|
+
│ ├── interactive/ # Interactive mode
|
|
59
|
+
│ │ ├── handler.ts # Clarification handling
|
|
60
|
+
│ │ ├── onboarding.ts # First-run setup
|
|
61
|
+
│ │ └── types.ts
|
|
62
|
+
│ ├── output/ # Output management
|
|
63
|
+
│ │ ├── manager.ts # File management
|
|
64
|
+
│ │ └── types.ts
|
|
65
|
+
│ ├── pipeline/ # Processing pipeline
|
|
66
|
+
│ │ ├── orchestrator.ts
|
|
67
|
+
│ │ └── types.ts
|
|
68
|
+
│ ├── phases/ # Processing phases
|
|
69
|
+
│ │ ├── locate.ts
|
|
70
|
+
│ │ ├── transcribe.ts
|
|
71
|
+
│ │ └── complete.ts
|
|
72
|
+
│ ├── prompt/ # Prompt templates
|
|
73
|
+
│ │ ├── personas/
|
|
74
|
+
│ │ │ └── transcriber.md
|
|
75
|
+
│ │ └── instructions/
|
|
76
|
+
│ │ └── transcribe.md
|
|
77
|
+
│ ├── reasoning/ # Reasoning integration
|
|
78
|
+
│ │ ├── client.ts # LLM client
|
|
79
|
+
│ │ ├── strategy.ts # Strategy selection
|
|
80
|
+
│ │ └── types.ts
|
|
81
|
+
│ ├── reflection/ # Self-reflection
|
|
82
|
+
│ │ ├── collector.ts # Metrics collection
|
|
83
|
+
│ │ ├── reporter.ts # Report generation
|
|
84
|
+
│ │ └── types.ts
|
|
85
|
+
│ ├── routing/ # Routing system
|
|
86
|
+
│ │ ├── classifier.ts # Signal classification
|
|
87
|
+
│ │ ├── router.ts # Path building
|
|
88
|
+
│ │ └── types.ts
|
|
89
|
+
│ ├── transcription/ # Transcription service
|
|
90
|
+
│ │ ├── service.ts # Whisper integration
|
|
91
|
+
│ │ └── types.ts
|
|
92
|
+
│ ├── util/ # Utilities
|
|
93
|
+
│ │ ├── child.ts
|
|
94
|
+
│ │ ├── dates.ts
|
|
95
|
+
│ │ ├── general.ts
|
|
96
|
+
│ │ ├── media.ts
|
|
97
|
+
│ │ ├── metadata.ts
|
|
98
|
+
│ │ ├── openai.ts
|
|
99
|
+
│ │ └── storage.ts
|
|
100
|
+
│ ├── error/ # Error types
|
|
101
|
+
│ │ └── ArgumentError.ts
|
|
102
|
+
│ ├── arguments.ts # CLI arguments
|
|
103
|
+
│ ├── constants.ts # Constants
|
|
104
|
+
│ ├── logging.ts # Logging
|
|
105
|
+
│ ├── main.ts # Entry point
|
|
106
|
+
│ ├── processor.ts # File processor
|
|
107
|
+
│ └── protokoll.ts # Main types
|
|
108
|
+
├── tests/ # Test files (mirrors src/)
|
|
109
|
+
├── guide/ # AI guide documentation
|
|
110
|
+
├── docs/ # User documentation site
|
|
111
|
+
└── output/ # Intermediate files (gitignored)
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
## Adding a New Tool
|
|
115
|
+
|
|
116
|
+
### 1. Create Tool File
|
|
117
|
+
|
|
118
|
+
```typescript
|
|
119
|
+
// src/agentic/tools/my-tool.ts
|
|
120
|
+
import { TranscriptionTool, ToolContext, ToolResult } from '../types';
|
|
121
|
+
|
|
122
|
+
export const createMyTool = (): TranscriptionTool => ({
|
|
123
|
+
name: 'my_tool',
|
|
124
|
+
description: 'Description for the reasoning model',
|
|
125
|
+
parameters: {
|
|
126
|
+
type: 'object',
|
|
127
|
+
properties: {
|
|
128
|
+
param1: { type: 'string', description: 'Parameter description' }
|
|
129
|
+
},
|
|
130
|
+
required: ['param1']
|
|
131
|
+
},
|
|
132
|
+
execute: async (args: { param1: string }, context: ToolContext): Promise<ToolResult> => {
|
|
133
|
+
// Implementation
|
|
134
|
+
return {
|
|
135
|
+
success: true,
|
|
136
|
+
data: { result: 'value' }
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
});
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
### 2. Register Tool
|
|
143
|
+
|
|
144
|
+
```typescript
|
|
145
|
+
// src/agentic/registry.ts
|
|
146
|
+
import { createMyTool } from './tools/my-tool';
|
|
147
|
+
|
|
148
|
+
export const create = (context: ToolContext): RegistryInstance => {
|
|
149
|
+
const tools: TranscriptionTool[] = [
|
|
150
|
+
// ... existing tools
|
|
151
|
+
createMyTool(),
|
|
152
|
+
];
|
|
153
|
+
// ...
|
|
154
|
+
};
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
### 3. Add Tests
|
|
158
|
+
|
|
159
|
+
```typescript
|
|
160
|
+
// tests/agentic/tools.test.ts
|
|
161
|
+
describe('my_tool', () => {
|
|
162
|
+
it('should do something', async () => {
|
|
163
|
+
const tool = createMyTool();
|
|
164
|
+
const result = await tool.execute({ param1: 'test' }, mockContext);
|
|
165
|
+
expect(result.success).toBe(true);
|
|
166
|
+
});
|
|
167
|
+
});
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
## Testing
|
|
171
|
+
|
|
172
|
+
### Run All Tests
|
|
173
|
+
|
|
174
|
+
```bash
|
|
175
|
+
npm test
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
### Run Specific Tests
|
|
179
|
+
|
|
180
|
+
```bash
|
|
181
|
+
npm test -- tests/context/
|
|
182
|
+
npm test -- --grep "should discover"
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
### Coverage
|
|
186
|
+
|
|
187
|
+
```bash
|
|
188
|
+
npm run test:coverage
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
## Code Style
|
|
192
|
+
|
|
193
|
+
### ESLint
|
|
194
|
+
|
|
195
|
+
```bash
|
|
196
|
+
npm run lint
|
|
197
|
+
npm run lint:fix
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
### TypeScript
|
|
201
|
+
|
|
202
|
+
- Strict mode enabled
|
|
203
|
+
- No implicit any
|
|
204
|
+
- Use interfaces for public APIs
|
|
205
|
+
- Use types for internal structures
|
|
206
|
+
|
|
207
|
+
### Conventions
|
|
208
|
+
|
|
209
|
+
- Use `create()` factory functions
|
|
210
|
+
- Export interfaces from index files
|
|
211
|
+
- Keep modules focused
|
|
212
|
+
- Document public APIs
|
|
213
|
+
|
|
214
|
+
## Dependencies
|
|
215
|
+
|
|
216
|
+
### Core
|
|
217
|
+
|
|
218
|
+
| Package | Purpose |
|
|
219
|
+
|---------|---------|
|
|
220
|
+
| `@theunwalked/dreadcabinet` | Filesystem patterns |
|
|
221
|
+
| `@theunwalked/cardigantime` | Hierarchical config discovery |
|
|
222
|
+
| `@riotprompt/riotprompt` | Prompt building and agentic execution |
|
|
223
|
+
| `openai` | OpenAI API (Whisper and GPT) |
|
|
224
|
+
| `@anthropic-ai/sdk` | Anthropic API (Claude) |
|
|
225
|
+
| `@google/generative-ai` | Google API (Gemini) |
|
|
226
|
+
|
|
227
|
+
### Dev
|
|
228
|
+
|
|
229
|
+
| Package | Purpose |
|
|
230
|
+
|---------|---------|
|
|
231
|
+
| `vitest` | Testing |
|
|
232
|
+
| `typescript` | Type checking |
|
|
233
|
+
| `eslint` | Linting |
|
|
234
|
+
| `vite` | Building |
|
|
235
|
+
|
|
236
|
+
## Release Process
|
|
237
|
+
|
|
238
|
+
1. Update version in `package.json`
|
|
239
|
+
2. Run tests: `npm test`
|
|
240
|
+
3. Build: `npm run build`
|
|
241
|
+
4. Commit: `git commit -m "Release vX.Y.Z"`
|
|
242
|
+
5. Tag: `git tag vX.Y.Z`
|
|
243
|
+
6. Push: `git push && git push --tags`
|
|
244
|
+
7. Publish: `npm publish`
|
|
245
|
+
|
|
246
|
+
## Debugging
|
|
247
|
+
|
|
248
|
+
### Verbose Mode
|
|
249
|
+
|
|
250
|
+
```bash
|
|
251
|
+
protokoll --verbose --input-directory ./recordings
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
### Debug Mode
|
|
255
|
+
|
|
256
|
+
```bash
|
|
257
|
+
protokoll --debug --input-directory ./recordings
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
Keeps intermediate files in `output/protokoll/`:
|
|
261
|
+
- `*-transcript.json` - Raw Whisper output
|
|
262
|
+
- `*-context.json` - Context snapshot
|
|
263
|
+
- `*-request.json` - LLM request
|
|
264
|
+
- `*-response.json` - LLM response
|
|
265
|
+
- `*-reflection.md` - Self-reflection report
|
|
266
|
+
- `*-session.json` - Interactive session log
|
|
267
|
+
|
|
268
|
+
### Node Debugging
|
|
269
|
+
|
|
270
|
+
```bash
|
|
271
|
+
node --inspect-brk dist/main.js --input-directory ./recordings
|
|
272
|
+
```
|
|
273
|
+
|