@redaksjon/protokoll 0.0.12 → 0.0.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (112) hide show
  1. package/.cursor/rules/definition-of-done.md +1 -0
  2. package/.cursor/rules/no-emoticons.md +26 -12
  3. package/README.md +681 -69
  4. package/dist/feedback.js +5193 -0
  5. package/dist/feedback.js.map +1 -0
  6. package/dist/main.js +1861 -2
  7. package/dist/main.js.map +1 -1
  8. package/dist/mcp/server.js +1330 -0
  9. package/dist/mcp/server.js.map +1 -0
  10. package/docs/duplicate-question-prevention.md +117 -0
  11. package/docs/examples.md +152 -0
  12. package/docs/interactive-context-example.md +92 -0
  13. package/docs/package-lock.json +6 -0
  14. package/docs/package.json +3 -1
  15. package/guide/action.md +375 -0
  16. package/guide/config.md +207 -0
  17. package/guide/configuration.md +82 -67
  18. package/guide/context-commands.md +574 -0
  19. package/guide/context-system.md +20 -7
  20. package/guide/development.md +106 -4
  21. package/guide/feedback.md +335 -0
  22. package/guide/index.md +116 -4
  23. package/guide/interactive.md +15 -14
  24. package/guide/mcp-integration.md +341 -0
  25. package/guide/quickstart.md +21 -7
  26. package/guide/reasoning.md +18 -4
  27. package/guide/routing.md +192 -97
  28. package/package.json +5 -3
  29. package/scripts/coverage-priority.mjs +323 -0
  30. package/tsconfig.tsbuildinfo +1 -1
  31. package/vite.config.ts +13 -29
  32. package/vitest.config.ts +5 -1
  33. package/dist/agentic/executor.js +0 -315
  34. package/dist/agentic/executor.js.map +0 -1
  35. package/dist/agentic/index.js +0 -19
  36. package/dist/agentic/index.js.map +0 -1
  37. package/dist/agentic/registry.js +0 -41
  38. package/dist/agentic/registry.js.map +0 -1
  39. package/dist/agentic/tools/lookup-person.js +0 -66
  40. package/dist/agentic/tools/lookup-person.js.map +0 -1
  41. package/dist/agentic/tools/lookup-project.js +0 -93
  42. package/dist/agentic/tools/lookup-project.js.map +0 -1
  43. package/dist/agentic/tools/route-note.js +0 -45
  44. package/dist/agentic/tools/route-note.js.map +0 -1
  45. package/dist/agentic/tools/store-context.js +0 -51
  46. package/dist/agentic/tools/store-context.js.map +0 -1
  47. package/dist/agentic/tools/verify-spelling.js +0 -57
  48. package/dist/agentic/tools/verify-spelling.js.map +0 -1
  49. package/dist/arguments.js +0 -175
  50. package/dist/arguments.js.map +0 -1
  51. package/dist/constants.js +0 -84
  52. package/dist/constants.js.map +0 -1
  53. package/dist/context/discovery.js +0 -114
  54. package/dist/context/discovery.js.map +0 -1
  55. package/dist/context/index.js +0 -58
  56. package/dist/context/index.js.map +0 -1
  57. package/dist/context/storage.js +0 -131
  58. package/dist/context/storage.js.map +0 -1
  59. package/dist/interactive/handler.js +0 -223
  60. package/dist/interactive/handler.js.map +0 -1
  61. package/dist/interactive/index.js +0 -18
  62. package/dist/interactive/index.js.map +0 -1
  63. package/dist/interactive/onboarding.js +0 -28
  64. package/dist/interactive/onboarding.js.map +0 -1
  65. package/dist/logging.js +0 -46
  66. package/dist/logging.js.map +0 -1
  67. package/dist/output/index.js +0 -8
  68. package/dist/output/index.js.map +0 -1
  69. package/dist/output/manager.js +0 -105
  70. package/dist/output/manager.js.map +0 -1
  71. package/dist/phases/complete.js +0 -107
  72. package/dist/phases/complete.js.map +0 -1
  73. package/dist/phases/locate.js +0 -64
  74. package/dist/phases/locate.js.map +0 -1
  75. package/dist/pipeline/index.js +0 -8
  76. package/dist/pipeline/index.js.map +0 -1
  77. package/dist/pipeline/orchestrator.js +0 -281
  78. package/dist/pipeline/orchestrator.js.map +0 -1
  79. package/dist/protokoll.js +0 -114
  80. package/dist/protokoll.js.map +0 -1
  81. package/dist/reasoning/client.js +0 -150
  82. package/dist/reasoning/client.js.map +0 -1
  83. package/dist/reasoning/index.js +0 -36
  84. package/dist/reasoning/index.js.map +0 -1
  85. package/dist/reasoning/strategy.js +0 -60
  86. package/dist/reasoning/strategy.js.map +0 -1
  87. package/dist/reflection/collector.js +0 -124
  88. package/dist/reflection/collector.js.map +0 -1
  89. package/dist/reflection/index.js +0 -16
  90. package/dist/reflection/index.js.map +0 -1
  91. package/dist/reflection/reporter.js +0 -238
  92. package/dist/reflection/reporter.js.map +0 -1
  93. package/dist/routing/classifier.js +0 -201
  94. package/dist/routing/classifier.js.map +0 -1
  95. package/dist/routing/index.js +0 -27
  96. package/dist/routing/index.js.map +0 -1
  97. package/dist/routing/router.js +0 -153
  98. package/dist/routing/router.js.map +0 -1
  99. package/dist/transcription/index.js +0 -41
  100. package/dist/transcription/index.js.map +0 -1
  101. package/dist/transcription/service.js +0 -64
  102. package/dist/transcription/service.js.map +0 -1
  103. package/dist/transcription/types.js +0 -31
  104. package/dist/transcription/types.js.map +0 -1
  105. package/dist/util/dates.js +0 -96
  106. package/dist/util/dates.js.map +0 -1
  107. package/dist/util/media.js +0 -103
  108. package/dist/util/media.js.map +0 -1
  109. package/dist/util/metadata.js +0 -95
  110. package/dist/util/metadata.js.map +0 -1
  111. package/dist/util/storage.js +0 -135
  112. package/dist/util/storage.js.map +0 -1
@@ -0,0 +1,341 @@
1
+ # MCP Integration Guide
2
+
3
+ Protokoll exposes its capabilities as an MCP (Model Context Protocol) server, allowing AI assistants to directly transcribe audio, manage context, and work with transcripts through natural conversation.
4
+
5
+ ## Why MCP?
6
+
7
+ Traditional CLI usage requires you to:
8
+ 1. Open a terminal
9
+ 2. Navigate to the right directory
10
+ 3. Remember command syntax
11
+ 4. Run commands manually
12
+
13
+ With MCP, you can simply say:
14
+ - "Hey, can you transcribe this recording?"
15
+ - "Add Sanjay Gupta as a person - Whisper keeps mishearing it as 'San Jay Grouper'"
16
+ - "This transcript should be in the Quantum Readiness project"
17
+
18
+ The AI assistant handles all the details.
19
+
20
+ ## Setup
21
+
22
+ ### 1. Install Protokoll
23
+
24
+ ```bash
25
+ npm install -g @redaksjon/protokoll
26
+ ```
27
+
28
+ ### 2. Configure Your AI Assistant
29
+
30
+ Add the Protokoll MCP server to your AI tool's configuration.
31
+
32
+ **For Cursor (Claude)**
33
+
34
+ Add to `~/.cursor/mcp.json`:
35
+
36
+ ```json
37
+ {
38
+ "mcpServers": {
39
+ "protokoll": {
40
+ "command": "protokoll-mcp"
41
+ }
42
+ }
43
+ }
44
+ ```
45
+
46
+ **For Claude Desktop**
47
+
48
+ Add to `~/Library/Application Support/Claude/claude_desktop_config.json` (macOS) or the equivalent on your platform:
49
+
50
+ ```json
51
+ {
52
+ "mcpServers": {
53
+ "protokoll": {
54
+ "command": "protokoll-mcp"
55
+ }
56
+ }
57
+ }
58
+ ```
59
+
60
+ ### 3. Set Environment Variables
61
+
62
+ The MCP server needs API keys to function:
63
+
64
+ ```bash
65
+ export OPENAI_API_KEY="sk-..." # Required for transcription & enhancement
66
+ export ANTHROPIC_API_KEY="sk-ant-..." # Optional, for Claude-based enhancement
67
+ ```
68
+
69
+ ## Project-Aware Configuration
70
+
71
+ **Important**: Protokoll supports multiple project configurations. When you have different `.protokoll` directories for different projects, the MCP server needs to know which configuration to use.
72
+
73
+ ### How Configuration Discovery Works
74
+
75
+ When you ask to transcribe a file, the MCP server:
76
+
77
+ 1. **Walks up the directory tree** from the audio file's location
78
+ 2. **Finds all `.protokoll` directories** in the hierarchy
79
+ 3. **Analyzes projects** to suggest which one the file belongs to
80
+ 4. **Asks for clarification** if there's ambiguity
81
+
82
+ ### Example Scenarios
83
+
84
+ **Scenario 1: File in a Project Directory**
85
+
86
+ ```
87
+ ~/projects/
88
+ ├── client-alpha/
89
+ │ ├── .protokoll/ # Client Alpha's config
90
+ │ │ ├── config.yaml
91
+ │ │ ├── people/
92
+ │ │ └── projects/
93
+ │ └── recordings/
94
+ │ └── meeting.m4a # ← You ask to transcribe this
95
+ ```
96
+
97
+ The AI will automatically use `client-alpha/.protokoll` configuration.
98
+
99
+ **Scenario 2: Ambiguous Location**
100
+
101
+ ```
102
+ ~/Documents/
103
+ ├── .protokoll/ # Global config with multiple projects
104
+ │ ├── projects/
105
+ │ │ ├── client-alpha.yaml
106
+ │ │ └── internal-notes.yaml
107
+ │ └── ...
108
+ └── Downloads/
109
+ └── recording.m4a # ← Where does this go?
110
+ ```
111
+
112
+ The AI will ask: *"I found 2 projects in your configuration. Which project is this recording for?"*
113
+
114
+ **Scenario 3: No Configuration Found**
115
+
116
+ If no `.protokoll` directory exists in the hierarchy, the AI will:
117
+ 1. Explain that no configuration was found
118
+ 2. Offer to help you set one up
119
+ 3. Process with defaults if you prefer
120
+
121
+ ## Available MCP Tools
122
+
123
+ ### Discovery Tools
124
+
125
+ | Tool | Description |
126
+ |------|-------------|
127
+ | `protokoll_discover_config` | Find and analyze .protokoll configurations |
128
+ | `protokoll_suggest_project` | Determine which project a file belongs to |
129
+
130
+ ### Transcription Tools
131
+
132
+ | Tool | Description |
133
+ |------|-------------|
134
+ | `protokoll_process_audio` | Process a single audio file |
135
+ | `protokoll_batch_process` | Process all audio files in a directory |
136
+
137
+ ### Context Management Tools
138
+
139
+ | Tool | Description |
140
+ |------|-------------|
141
+ | `protokoll_context_status` | Get overview of context (projects, people, terms) |
142
+ | `protokoll_list_projects` | List all configured projects |
143
+ | `protokoll_list_people` | List all people in context |
144
+ | `protokoll_list_terms` | List all technical terms |
145
+ | `protokoll_list_companies` | List all companies |
146
+ | `protokoll_search_context` | Search across all context types |
147
+ | `protokoll_get_entity` | Get details of a specific entity |
148
+
149
+ ### Entity Management Tools
150
+
151
+ | Tool | Description |
152
+ |------|-------------|
153
+ | `protokoll_add_person` | Add a new person to context |
154
+ | `protokoll_add_project` | Add a new project |
155
+ | `protokoll_add_term` | Add a technical term |
156
+ | `protokoll_add_company` | Add a company |
157
+ | `protokoll_add_ignored_term` | Add a term to ignore |
158
+ | `protokoll_delete_entity` | Remove an entity |
159
+
160
+ ### Transcript Tools
161
+
162
+ | Tool | Description |
163
+ |------|-------------|
164
+ | `protokoll_edit_transcript` | Change transcript title or project |
165
+ | `protokoll_combine_transcripts` | Merge multiple transcripts |
166
+ | `protokoll_provide_feedback` | Correct transcription errors |
167
+
168
+ ## Example Conversations
169
+
170
+ ### Basic Transcription
171
+
172
+ **You**: "Can you transcribe the meeting recording at ~/Downloads/standup.m4a?"
173
+
174
+ **AI**: *Calls `protokoll_discover_config` to find configuration*
175
+ *Calls `protokoll_suggest_project` to determine project*
176
+
177
+ "I found your Protokoll configuration at `~/.protokoll`. You have 3 projects configured. Based on the file location, I'm not sure which project this belongs to. Is this for:
178
+ 1. Client Alpha
179
+ 2. Internal Notes
180
+ 3. Personal"
181
+
182
+ **You**: "It's for Client Alpha"
183
+
184
+ **AI**: *Calls `protokoll_process_audio` with projectId: "client-alpha"*
185
+
186
+ "Done! I've transcribed the standup recording. The transcript is saved at `~/notes/client-alpha/2026-01/standup-a3f2b1c8.md`.
187
+
188
+ Key highlights:
189
+ - Discussed sprint progress with Sarah and Marcus
190
+ - Mentioned the API integration deadline
191
+ - Applied 4 name corrections using your context
192
+
193
+ Would you like me to make any changes to the transcript?"
194
+
195
+ ### Adding Context
196
+
197
+ **You**: "Whisper keeps mishearing 'Priya Sharma' as 'pre a Sharma'. Can you add her to my context?"
198
+
199
+ **AI**: *Calls `protokoll_add_person`*
200
+
201
+ "I've added Priya Sharma to your context with the phonetic variant 'pre a'. Future transcripts will automatically correct this. Would you like to add any other information about Priya (role, company, etc.)?"
202
+
203
+ ### Providing Feedback
204
+
205
+ **You**: "In the transcript at ~/notes/meeting.md, 'WCMP' should be 'WCNP' and this should be in the Infrastructure project"
206
+
207
+ **AI**: *Calls `protokoll_provide_feedback`*
208
+
209
+ "I've made the corrections:
210
+ 1. Changed 'WCMP' to 'WCNP' (2 occurrences)
211
+ 2. Moved the transcript to the Infrastructure project at `~/notes/infrastructure/meeting.md`
212
+
213
+ I also noticed 'WCNP' isn't in your terms. Would you like me to add it so future transcripts get it right?"
214
+
215
+ ### Combining Transcripts
216
+
217
+ **You**: "Can you combine all the meeting parts in ~/notes/client-alpha/2026-01/ into a single transcript?"
218
+
219
+ **AI**: *Lists files, then calls `protokoll_combine_transcripts`*
220
+
221
+ "I found 3 meeting parts. Combined them into 'Full Meeting Notes' at `~/notes/client-alpha/2026-01/full-meeting-notes.md`. The original part files have been removed."
222
+
223
+ ## Best Practices
224
+
225
+ ### 1. Set Up Project Configurations
226
+
227
+ Create `.protokoll` directories at appropriate levels:
228
+
229
+ ```
230
+ ~/work/
231
+ ├── .protokoll/ # Shared work context (common terms, companies)
232
+ │ ├── config.yaml
233
+ │ ├── terms/ # Industry terminology
234
+ │ └── companies/ # All clients
235
+
236
+ ├── client-alpha/
237
+ │ └── .protokoll/ # Client-specific context
238
+ │ ├── people/ # Client Alpha contacts
239
+ │ └── projects/ # Client Alpha projects
240
+
241
+ └── client-beta/
242
+ └── .protokoll/ # Client Beta context
243
+ ```
244
+
245
+ ### 2. Use Project Routing
246
+
247
+ Configure projects with destinations so transcripts automatically land in the right place:
248
+
249
+ ```yaml
250
+ # .protokoll/projects/client-alpha.yaml
251
+ id: client-alpha
252
+ name: Client Alpha
253
+ routing:
254
+ destination: ~/notes/client-alpha
255
+ classification:
256
+ explicit_phrases:
257
+ - "alpha"
258
+ - "Project Alpha"
259
+ ```
260
+
261
+ ### 3. Build Context Incrementally
262
+
263
+ When the AI asks about corrections:
264
+ - Accept suggestions to add names to people context
265
+ - Accept suggestions to add terms
266
+ - This improves future transcriptions automatically
267
+
268
+ ### 4. Use Feedback for Corrections
269
+
270
+ Instead of manually editing transcripts:
271
+ - Tell the AI what's wrong in natural language
272
+ - It will fix the transcript AND update context to prevent future errors
273
+
274
+ ## Troubleshooting
275
+
276
+ ### "No configuration found"
277
+
278
+ Create a `.protokoll` directory:
279
+ ```bash
280
+ mkdir ~/.protokoll
281
+ protokoll config # Interactive setup
282
+ ```
283
+
284
+ Or ask the AI to help set one up.
285
+
286
+ ### "Multiple projects - which one?"
287
+
288
+ This is expected behavior. The AI needs clarification when:
289
+ - File location doesn't clearly belong to one project
290
+ - Multiple projects could apply
291
+
292
+ Just tell it which project to use.
293
+
294
+ ### "API key not set"
295
+
296
+ Ensure your shell exports the necessary keys:
297
+ ```bash
298
+ export OPENAI_API_KEY="sk-..."
299
+ ```
300
+
301
+ The MCP server inherits environment from how it was launched.
302
+
303
+ ### Slow First Transcription
304
+
305
+ The first transcription may be slower because:
306
+ 1. Whisper model loads
307
+ 2. Context files are parsed
308
+ 3. LLM connections initialize
309
+
310
+ Subsequent transcriptions are faster.
311
+
312
+ ## Advanced: Multiple Workspaces
313
+
314
+ If you work across completely separate contexts (e.g., work vs personal), you have options:
315
+
316
+ ### Option A: Nested Configurations
317
+
318
+ ```
319
+ ~/.protokoll/ # Base config (shared terms)
320
+ ~/work/.protokoll/ # Work overlay
321
+ ~/personal/.protokoll/ # Personal overlay
322
+ ```
323
+
324
+ The nearest `.protokoll` takes precedence.
325
+
326
+ ### Option B: Environment-Based Switching
327
+
328
+ ```bash
329
+ # Work profile
330
+ export PROTOKOLL_CONFIG=~/.protokoll-work
331
+
332
+ # Personal profile
333
+ export PROTOKOLL_CONFIG=~/.protokoll-personal
334
+ ```
335
+
336
+ ## See Also
337
+
338
+ - [Configuration](./configuration.md) - All configuration options
339
+ - [Context System](./context-system.md) - How context storage works
340
+ - [Routing](./routing.md) - Project routing configuration
341
+ - [Feedback](./feedback.md) - How feedback corrections work
@@ -43,10 +43,8 @@ mkdir -p ~/.protokoll
43
43
  ```yaml
44
44
  # ~/.protokoll/config.yaml
45
45
  model: "gpt-5.2"
46
- routing:
47
- default:
48
- path: "~/notes"
49
- structure: "month"
46
+ outputDirectory: "~/notes"
47
+ outputStructure: "month"
50
48
  ```
51
49
 
52
50
  ## First Transcription
@@ -59,12 +57,24 @@ protokoll --input-directory ~/recordings
59
57
  # Self-reflection report is generated by default
60
58
  ```
61
59
 
60
+ When processing multiple files, you'll see progress indicators:
61
+
62
+ ```
63
+ Found 11 file(s) to process in ~/recordings
64
+ [1/11] Starting: ~/recordings/meeting.m4a
65
+ [1/11] Transcribing audio...
66
+ [1/11] Enhancing with gpt-5.2...
67
+ [1/11] Output: ~/notes/2026/01/260115-meeting.md (7.3s total)
68
+ [2/11] Starting: ~/recordings/quick-thought.m4a
69
+ ...
70
+ ```
71
+
62
72
  ## Interactive Mode
63
73
 
64
- Learn names and projects as you go:
74
+ Interactive mode is **enabled by default**. Protokoll will ask questions to learn names and projects as you go:
65
75
 
66
76
  ```bash
67
- protokoll --input-directory ~/recordings --interactive
77
+ protokoll --input-directory ~/recordings
68
78
  ```
69
79
 
70
80
  Protokoll will ask:
@@ -111,6 +121,9 @@ protokoll --input-directory ~/recordings --debug
111
121
  # Disable self-reflection (enabled by default)
112
122
  protokoll --input-directory ~/recordings --no-self-reflection
113
123
 
124
+ # Disable interactive mode (for automation/cron jobs)
125
+ protokoll --input-directory ~/recordings --batch
126
+
114
127
  # Dry run (show what would happen)
115
128
  protokoll --input-directory ~/recordings --dry-run
116
129
 
@@ -124,8 +137,9 @@ protokoll --input-directory ~/recordings --model claude-3-5-sonnet
124
137
  |--------|---------|
125
138
  | `--model` | `gpt-5.2` |
126
139
  | `--transcription-model` | `whisper-1` |
140
+ | `--reasoning-level` | `medium` |
127
141
  | `--self-reflection` | `true` (enabled) |
128
- | `--interactive` | `false` (disabled) |
142
+ | Interactive mode | `true` (enabled, use `--batch` to disable) |
129
143
  | Output structure | `month` |
130
144
  | Filename options | `date`, `time`, `subject` |
131
145
 
@@ -45,14 +45,27 @@ The reasoning system:
45
45
  ```yaml
46
46
  # ~/.protokoll/config.yaml
47
47
  model: "gpt-5.2"
48
+ reasoningLevel: "medium" # low, medium, or high
48
49
  ```
49
50
 
50
51
  Or via command line:
51
52
 
52
53
  ```bash
53
- protokoll --model claude-3-5-sonnet --input-directory ./recordings
54
+ protokoll --model claude-3-5-sonnet --reasoning-level medium --input-directory ./recordings
54
55
  ```
55
56
 
57
+ ## Reasoning Levels
58
+
59
+ For models that support the `reasoning_effort` parameter (gpt-5.1, gpt-5.2, o1, o1-mini, o3, o3-mini), you can control how much reasoning effort the model expends:
60
+
61
+ | Level | Description | Best For |
62
+ |-------|-------------|----------|
63
+ | `low` | Quick processing, minimal reasoning | Simple transcripts with few corrections needed |
64
+ | `medium` | **Default** - Balanced reasoning | Standard transcription with context lookup |
65
+ | `high` | Maximum reasoning effort | Unusual or highly technical content |
66
+
67
+ The default is `medium` because transcript enhancement benefits from balanced reasoning: looking up names, correcting spellings, and categorizing content requires moderate context analysis. Use `low` for simple transcripts with few corrections needed, or `high` for complex technical content.
68
+
56
69
  ## Reasoning Strategies
57
70
 
58
71
  ### Simple
@@ -175,9 +188,10 @@ interface ReasoningResponse {
175
188
 
176
189
  ### Slow Processing
177
190
 
178
- 1. Use faster model: `--model gpt-4o-mini`
179
- 2. Check self-reflection for bottlenecks
180
- 3. Add more context to reduce iterations
191
+ 1. Use lower reasoning level: `--reasoning-level low`
192
+ 2. Use faster model: `--model gpt-4o-mini`
193
+ 3. Check self-reflection for bottlenecks
194
+ 4. Add more context to reduce iterations
181
195
 
182
196
  ### Poor Quality
183
197