thoth-plugin 1.2.4 → 1.2.6

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 (101) hide show
  1. package/README.md +17 -1
  2. package/defaults/skill/cal-grid/SKILL.md +168 -0
  3. package/defaults/skill/cal-grid/cal-grid-template.md +106 -0
  4. package/defaults/skill/context-discovery/SKILL.md +253 -0
  5. package/defaults/skill/context-discovery/discovery.prose +143 -0
  6. package/defaults/skill/context-onboarding/SKILL.md +370 -0
  7. package/{dist/defaults/skill/_legacy/email-draft/skill.md → defaults/skill/email-draft/SKILL.md} +33 -30
  8. package/defaults/skill/evening-close/SKILL.md +93 -61
  9. package/defaults/skill/evening-close/evening-close-template.md +42 -0
  10. package/{dist/defaults/skill/_legacy → defaults/skill}/gardener/SKILL.md +3 -3
  11. package/{dist/defaults/skill/_legacy → defaults/skill}/google-chat-scan/SKILL.md +7 -0
  12. package/{dist/defaults/skill/_legacy → defaults/skill}/leadership-coach/SKILL.md +9 -8
  13. package/defaults/skill/mail-triage/SKILL.md +272 -15
  14. package/defaults/skill/mail-triage/mail-triage-template.md +90 -0
  15. package/defaults/skill/morning-boot/SKILL.md +214 -25
  16. package/defaults/skill/morning-boot/daily-log-template.md +98 -0
  17. package/defaults/skill/morning-boot/morning-boot.prose +98 -0
  18. package/defaults/skill/{_legacy/onboarding → onboarding}/SKILL.md +7 -6
  19. package/defaults/skill/open-prose/SKILL.md +373 -0
  20. package/defaults/skill/open-prose/antipatterns.md +852 -0
  21. package/defaults/skill/open-prose/docs.md +2676 -0
  22. package/defaults/skill/open-prose/patterns.md +610 -0
  23. package/defaults/skill/open-prose/prose.md +950 -0
  24. package/{dist/defaults/skill/_legacy → defaults/skill}/post-meeting-drill/SKILL.md +90 -95
  25. package/defaults/skill/post-meeting-drill/examples.md +130 -0
  26. package/defaults/skill/post-meeting-drill/post-meeting-drill-template.md +111 -0
  27. package/defaults/skill/skill-generator/SKILL.md +217 -0
  28. package/defaults/skill/skill-generator/skill-template.md +163 -0
  29. package/defaults/skill/slack-pulse/SKILL.md +211 -14
  30. package/defaults/skill/slack-pulse/slack-pulse-template.md +98 -0
  31. package/defaults/skill/slack-write/skill.md +184 -0
  32. package/defaults/skill/thought-router/SKILL.md +12 -9
  33. package/dist/cli.js +137 -3
  34. package/dist/config/schema.d.ts +0 -2
  35. package/dist/defaults/skill/cal-grid/SKILL.md +168 -0
  36. package/dist/defaults/skill/cal-grid/cal-grid-template.md +106 -0
  37. package/dist/defaults/skill/context-discovery/SKILL.md +253 -0
  38. package/dist/defaults/skill/context-discovery/discovery.prose +143 -0
  39. package/dist/defaults/skill/context-onboarding/SKILL.md +370 -0
  40. package/{defaults/skill/_legacy/email-draft/skill.md → dist/defaults/skill/email-draft/SKILL.md} +33 -30
  41. package/dist/defaults/skill/evening-close/SKILL.md +93 -61
  42. package/dist/defaults/skill/evening-close/evening-close-template.md +42 -0
  43. package/{defaults/skill/_legacy → dist/defaults/skill}/gardener/SKILL.md +3 -3
  44. package/{defaults/skill/_legacy → dist/defaults/skill}/google-chat-scan/SKILL.md +7 -0
  45. package/{defaults/skill/_legacy → dist/defaults/skill}/leadership-coach/SKILL.md +9 -8
  46. package/dist/defaults/skill/mail-triage/SKILL.md +272 -15
  47. package/dist/defaults/skill/mail-triage/mail-triage-template.md +90 -0
  48. package/dist/defaults/skill/morning-boot/SKILL.md +214 -25
  49. package/dist/defaults/skill/morning-boot/daily-log-template.md +98 -0
  50. package/dist/defaults/skill/morning-boot/morning-boot.prose +98 -0
  51. package/dist/defaults/skill/{_legacy/onboarding → onboarding}/SKILL.md +7 -6
  52. package/dist/defaults/skill/open-prose/SKILL.md +373 -0
  53. package/dist/defaults/skill/open-prose/antipatterns.md +852 -0
  54. package/dist/defaults/skill/open-prose/docs.md +2676 -0
  55. package/dist/defaults/skill/open-prose/patterns.md +610 -0
  56. package/dist/defaults/skill/open-prose/prose.md +950 -0
  57. package/{defaults/skill/_legacy → dist/defaults/skill}/post-meeting-drill/SKILL.md +90 -95
  58. package/dist/defaults/skill/post-meeting-drill/examples.md +130 -0
  59. package/dist/defaults/skill/post-meeting-drill/post-meeting-drill-template.md +111 -0
  60. package/dist/defaults/skill/skill-generator/SKILL.md +217 -0
  61. package/dist/defaults/skill/skill-generator/skill-template.md +163 -0
  62. package/dist/defaults/skill/slack-pulse/SKILL.md +211 -14
  63. package/dist/defaults/skill/slack-pulse/slack-pulse-template.md +98 -0
  64. package/dist/defaults/skill/slack-write/skill.md +184 -0
  65. package/dist/defaults/skill/thought-router/SKILL.md +12 -9
  66. package/dist/hooks/index.d.ts +0 -1
  67. package/dist/index.js +14 -201
  68. package/dist/sdk/index.d.ts +1 -1
  69. package/dist/sdk/sentinel-service.d.ts +0 -1
  70. package/dist/sdk/test-harness.d.ts +90 -0
  71. package/dist/shared/index.d.ts +0 -1
  72. package/dist/specialization/prompt-sections.d.ts +1 -1
  73. package/package.json +1 -1
  74. package/defaults/skill/_legacy/cal-grid/SKILL.md +0 -16
  75. package/defaults/skill/_legacy/skill-generator/SKILL.md +0 -362
  76. package/dist/defaults/skill/_legacy/cal-grid/SKILL.md +0 -16
  77. package/dist/defaults/skill/_legacy/skill-generator/SKILL.md +0 -362
  78. package/dist/hooks/temporal-awareness.d.ts +0 -31
  79. package/dist/hooks/temporal-awareness.test.d.ts +0 -1
  80. /package/defaults/skill/{_legacy/capsule-init → capsule-init}/SKILL.md +0 -0
  81. /package/defaults/skill/{_legacy/cross-linker → cross-linker}/SKILL.md +0 -0
  82. /package/defaults/skill/{_legacy/gardener → gardener}/confidence-tiers.md +0 -0
  83. /package/defaults/skill/{_legacy/gardener → gardener}/repair-workflow.md +0 -0
  84. /package/defaults/skill/{_legacy/handover → handover}/SKILL.md +0 -0
  85. /package/defaults/skill/{_legacy/interview-prep → interview-prep}/SKILL.md +0 -0
  86. /package/defaults/skill/{_legacy/link-retrofit → link-retrofit}/SKILL.md +0 -0
  87. /package/defaults/skill/{_legacy/restore-environment → restore-environment}/SKILL.md +0 -0
  88. /package/defaults/skill/{_legacy/scorecard-synthesis → scorecard-synthesis}/SKILL.md +0 -0
  89. /package/defaults/skill/{_legacy/skill-generator → skill-generator}/testing-protocol.md +0 -0
  90. /package/defaults/skill/{_legacy/system-init → system-init}/SKILL.md +0 -0
  91. /package/dist/defaults/skill/{_legacy/capsule-init → capsule-init}/SKILL.md +0 -0
  92. /package/dist/defaults/skill/{_legacy/cross-linker → cross-linker}/SKILL.md +0 -0
  93. /package/dist/defaults/skill/{_legacy/gardener → gardener}/confidence-tiers.md +0 -0
  94. /package/dist/defaults/skill/{_legacy/gardener → gardener}/repair-workflow.md +0 -0
  95. /package/dist/defaults/skill/{_legacy/handover → handover}/SKILL.md +0 -0
  96. /package/dist/defaults/skill/{_legacy/interview-prep → interview-prep}/SKILL.md +0 -0
  97. /package/dist/defaults/skill/{_legacy/link-retrofit → link-retrofit}/SKILL.md +0 -0
  98. /package/dist/defaults/skill/{_legacy/restore-environment → restore-environment}/SKILL.md +0 -0
  99. /package/dist/defaults/skill/{_legacy/scorecard-synthesis → scorecard-synthesis}/SKILL.md +0 -0
  100. /package/dist/defaults/skill/{_legacy/skill-generator → skill-generator}/testing-protocol.md +0 -0
  101. /package/dist/defaults/skill/{_legacy/system-init → system-init}/SKILL.md +0 -0
@@ -0,0 +1,852 @@
1
+ ---
2
+ role: antipatterns
3
+ summary: |
4
+ see-also:
5
+ - prose.md: Execution semantics, how to run programs
6
+ - docs.md: Full syntax grammar, validation rules
7
+ - patterns.md: Recommended design patterns
8
+ created: 2026-01-09
9
+ updated: 2026-01-09
10
+ ---
11
+
12
+ # OpenProse Antipatterns
13
+
14
+ This document catalogs patterns that lead to brittle, expensive, slow, or unmaintainable programs. Each antipattern includes recognition criteria and remediation guidance.
15
+
16
+ ---
17
+
18
+ ## Structural Antipatterns
19
+
20
+ #### god-session
21
+
22
+ A single session that tries to do everything. God sessions are hard to debug, impossible to parallelize, and produce inconsistent results.
23
+
24
+ ```prose
25
+ # Bad: One session doing too much
26
+ session """
27
+ Read all the code in the repository.
28
+ Identify security vulnerabilities.
29
+ Find performance bottlenecks.
30
+ Check for style violations.
31
+ Generate a comprehensive report.
32
+ Suggest fixes for each issue.
33
+ Prioritize by severity.
34
+ Create a remediation plan.
35
+ """
36
+ ```
37
+
38
+ **Why it's bad**: The session has no clear completion criteria. It mixes concerns that could be parallelized. Failure anywhere fails everything.
39
+
40
+ **Fix**: Decompose into focused sessions:
41
+
42
+ ```prose
43
+ # Good: Focused sessions
44
+ parallel:
45
+ security = session "Identify security vulnerabilities"
46
+ perf = session "Find performance bottlenecks"
47
+ style = session "Check for style violations"
48
+
49
+ session "Synthesize findings and prioritize by severity"
50
+ context: { security, perf, style }
51
+
52
+ session "Create remediation plan"
53
+ ```
54
+
55
+ #### sequential-when-parallel
56
+
57
+ Running independent operations sequentially when they could run concurrently. Wastes wall-clock time.
58
+
59
+ ```prose
60
+ # Bad: Sequential independent work
61
+ let market = session "Research market"
62
+ let tech = session "Research technology"
63
+ let competition = session "Research competition"
64
+
65
+ session "Synthesize"
66
+ context: [market, tech, competition]
67
+ ```
68
+
69
+ **Why it's bad**: Total time is sum of all research times. Each session waits for the previous one unnecessarily.
70
+
71
+ **Fix**: Parallelize independent work:
72
+
73
+ ```prose
74
+ # Good: Parallel independent work
75
+ parallel:
76
+ market = session "Research market"
77
+ tech = session "Research technology"
78
+ competition = session "Research competition"
79
+
80
+ session "Synthesize"
81
+ context: { market, tech, competition }
82
+ ```
83
+
84
+ #### spaghetti-context
85
+
86
+ Context passed haphazardly without clear data flow. Makes programs hard to understand and modify.
87
+
88
+ ```prose
89
+ # Bad: Unclear what context is actually used
90
+ let a = session "Step A"
91
+ let b = session "Step B"
92
+ context: a
93
+ let c = session "Step C"
94
+ context: [a, b]
95
+ let d = session "Step D"
96
+ context: [a, b, c]
97
+ let e = session "Step E"
98
+ context: [a, c, d] # Why not b?
99
+ let f = session "Step F"
100
+ context: [a, b, c, d, e] # Everything?
101
+ ```
102
+
103
+ **Why it's bad**: Unclear which sessions depend on which outputs. Hard to parallelize or refactor.
104
+
105
+ **Fix**: Minimize context to actual dependencies:
106
+
107
+ ```prose
108
+ # Good: Clear, minimal dependencies
109
+ let research = session "Research"
110
+ let analysis = session "Analyze"
111
+ context: research
112
+ let recommendations = session "Recommend"
113
+ context: analysis # Only needs analysis, not research
114
+ let report = session "Report"
115
+ context: recommendations
116
+ ```
117
+
118
+ #### copy-paste-workflows
119
+
120
+ Duplicating session sequences instead of using blocks. Leads to inconsistent changes and maintenance burden.
121
+
122
+ ```prose
123
+ # Bad: Duplicated workflow
124
+ session "Security review of module A"
125
+ session "Performance review of module A"
126
+ session "Synthesize reviews of module A"
127
+
128
+ session "Security review of module B"
129
+ session "Performance review of module B"
130
+ session "Synthesize reviews of module B"
131
+
132
+ session "Security review of module C"
133
+ session "Performance review of module C"
134
+ session "Synthesize reviews of module C"
135
+ ```
136
+
137
+ **Why it's bad**: If the workflow needs to change, you must change it everywhere. Easy to miss one.
138
+
139
+ **Fix**: Extract into a block:
140
+
141
+ ```prose
142
+ # Good: Reusable block
143
+ block review-module(module):
144
+ parallel:
145
+ sec = session "Security review of {module}"
146
+ perf = session "Performance review of {module}"
147
+ session "Synthesize reviews of {module}"
148
+ context: { sec, perf }
149
+
150
+ do review-module("module A")
151
+ do review-module("module B")
152
+ do review-module("module C")
153
+ ```
154
+
155
+ ---
156
+
157
+ ## Robustness Antipatterns
158
+
159
+ #### unbounded-loop
160
+
161
+ A loop without max iterations. Can run forever if the condition is never satisfied.
162
+
163
+ ```prose
164
+ # Bad: No escape hatch
165
+ loop until **the code is perfect**:
166
+ session "Improve the code"
167
+ ```
168
+
169
+ **Why it's bad**: "Perfect" may never be achieved. The program could run indefinitely, consuming resources.
170
+
171
+ **Fix**: Always specify `max:`:
172
+
173
+ ```prose
174
+ # Good: Bounded iteration
175
+ loop until **the code is perfect** (max: 10):
176
+ session "Improve the code"
177
+ ```
178
+
179
+ #### optimistic-execution
180
+
181
+ Assuming everything will succeed. No error handling for operations that can fail.
182
+
183
+ ```prose
184
+ # Bad: No error handling
185
+ session "Call external API"
186
+ session "Process API response"
187
+ session "Store results in database"
188
+ session "Send notification"
189
+ ```
190
+
191
+ **Why it's bad**: If the API fails, subsequent sessions receive no valid input. Silent corruption.
192
+
193
+ **Fix**: Handle failures explicitly:
194
+
195
+ ```prose
196
+ # Good: Error handling
197
+ try:
198
+ let response = session "Call external API"
199
+ retry: 3
200
+ backoff: "exponential"
201
+ session "Process API response"
202
+ context: response
203
+ catch as err:
204
+ session "Handle API failure gracefully"
205
+ context: err
206
+ ```
207
+
208
+ #### ignored-errors
209
+
210
+ Using `on-fail: "ignore"` when failures actually matter. Masks problems that should surface.
211
+
212
+ ```prose
213
+ # Bad: Ignoring failures that matter
214
+ parallel (on-fail: "ignore"):
215
+ session "Charge customer credit card"
216
+ session "Ship the product"
217
+ session "Send confirmation email"
218
+
219
+ session "Order complete!" # But was it really?
220
+ ```
221
+
222
+ **Why it's bad**: The order might be marked complete even if payment failed.
223
+
224
+ **Fix**: Use appropriate failure policy:
225
+
226
+ ```prose
227
+ # Good: Fail-fast for critical operations
228
+ parallel: # Default: fail-fast
229
+ payment = session "Charge customer credit card"
230
+ inventory = session "Reserve inventory"
231
+
232
+ # Only ship if both succeeded
233
+ session "Ship the product"
234
+ context: { payment, inventory }
235
+
236
+ # Email can fail without blocking
237
+ try:
238
+ session "Send confirmation email"
239
+ catch:
240
+ session "Queue email for retry"
241
+ ```
242
+
243
+ #### vague-discretion
244
+
245
+ Discretion conditions that are ambiguous or unmeasurable.
246
+
247
+ ```prose
248
+ # Bad: What does "good enough" mean?
249
+ loop until **the output is good enough**:
250
+ session "Improve output"
251
+
252
+ # Bad: Highly subjective
253
+ if **the user will be happy**:
254
+ session "Ship it"
255
+ ```
256
+
257
+ **Why it's bad**: The VM has no clear criteria for evaluation. Results are unpredictable.
258
+
259
+ **Fix**: Provide concrete, evaluatable criteria:
260
+
261
+ ```prose
262
+ # Good: Specific criteria
263
+ loop until **all tests pass and code coverage exceeds 80%** (max: 10):
264
+ session "Improve test coverage"
265
+
266
+ # Good: Observable conditions
267
+ if **the response contains valid JSON with all required fields**:
268
+ session "Process the response"
269
+ ```
270
+
271
+ #### catch-and-swallow
272
+
273
+ Catching errors without meaningful handling. Hides problems without solving them.
274
+
275
+ ```prose
276
+ # Bad: Silent swallow
277
+ try:
278
+ session "Critical operation"
279
+ catch:
280
+ # Nothing here - error disappears
281
+ ```
282
+
283
+ **Why it's bad**: Errors vanish. No recovery, no logging, no visibility.
284
+
285
+ **Fix**: Handle errors meaningfully:
286
+
287
+ ```prose
288
+ # Good: Meaningful handling
289
+ try:
290
+ session "Critical operation"
291
+ catch as err:
292
+ session "Log error for investigation"
293
+ context: err
294
+ session "Execute fallback procedure"
295
+ # Or rethrow if unrecoverable:
296
+ throw
297
+ ```
298
+
299
+ ---
300
+
301
+ ## Cost Antipatterns
302
+
303
+ #### opus-for-everything
304
+
305
+ Using the most powerful (expensive) model for all tasks, including trivial ones.
306
+
307
+ ```prose
308
+ # Bad: Opus for simple classification
309
+ agent classifier:
310
+ model: opus
311
+ prompt: "Categorize items as: spam, not-spam"
312
+
313
+ # Expensive for a binary classification
314
+ for email in emails:
315
+ session: classifier
316
+ prompt: "Classify: {email}"
317
+ ```
318
+
319
+ **Why it's bad**: Opus costs significantly more than haiku. Simple tasks don't benefit from advanced reasoning.
320
+
321
+ **Fix**: Match model to task complexity:
322
+
323
+ ```prose
324
+ # Good: Haiku for simple tasks
325
+ agent classifier:
326
+ model: haiku
327
+ prompt: "Categorize items as: spam, not-spam"
328
+ ```
329
+
330
+ #### context-bloat
331
+
332
+ Passing excessive context that the session doesn't need.
333
+
334
+ ```prose
335
+ # Bad: Passing everything
336
+ let full_codebase = session "Read entire codebase"
337
+ let all_docs = session "Read all documentation"
338
+ let history = session "Get full git history"
339
+
340
+ session "Fix the typo in the README"
341
+ context: [full_codebase, all_docs, history] # Massive overkill
342
+ ```
343
+
344
+ **Why it's bad**: Large contexts slow processing, increase costs, and can confuse the model with irrelevant information.
345
+
346
+ **Fix**: Pass minimal relevant context:
347
+
348
+ ```prose
349
+ # Good: Minimal context
350
+ let readme = session "Read the README file"
351
+
352
+ session "Fix the typo in the README"
353
+ context: readme
354
+ ```
355
+
356
+ #### unnecessary-iteration
357
+
358
+ Looping when a single session would suffice.
359
+
360
+ ```prose
361
+ # Bad: Loop for what could be one call
362
+ let items = ["apple", "banana", "cherry"]
363
+ for item in items:
364
+ session "Describe {item}"
365
+ ```
366
+
367
+ **Why it's bad**: Three sessions when one could handle all items. Session overhead multiplied.
368
+
369
+ **Fix**: Batch when possible:
370
+
371
+ ```prose
372
+ # Good: Batch processing
373
+ let items = ["apple", "banana", "cherry"]
374
+ session "Describe each of these items: {items}"
375
+ ```
376
+
377
+ #### redundant-computation
378
+
379
+ Computing the same thing multiple times.
380
+
381
+ ```prose
382
+ # Bad: Redundant research
383
+ session "Research AI safety for security review"
384
+ session "Research AI safety for ethics review"
385
+ session "Research AI safety for compliance review"
386
+ ```
387
+
388
+ **Why it's bad**: Same research done three times with slightly different framing.
389
+
390
+ **Fix**: Compute once, use many times:
391
+
392
+ ```prose
393
+ # Good: Compute once
394
+ let research = session "Comprehensive research on AI safety"
395
+
396
+ parallel:
397
+ session "Security review"
398
+ context: research
399
+ session "Ethics review"
400
+ context: research
401
+ session "Compliance review"
402
+ context: research
403
+ ```
404
+
405
+ ---
406
+
407
+ ## Performance Antipatterns
408
+
409
+ #### eager-over-computation
410
+
411
+ Computing everything upfront when only some results might be needed.
412
+
413
+ ```prose
414
+ # Bad: Compute all branches even if only one is needed
415
+ parallel:
416
+ simple_analysis = session "Simple analysis"
417
+ model: haiku
418
+ detailed_analysis = session "Detailed analysis"
419
+ model: sonnet
420
+ deep_analysis = session "Deep analysis"
421
+ model: opus
422
+
423
+ # Then only use one based on some criterion
424
+ choice **appropriate depth**:
425
+ option "Simple":
426
+ session "Use simple"
427
+ context: simple_analysis
428
+ option "Detailed":
429
+ session "Use detailed"
430
+ context: detailed_analysis
431
+ option "Deep":
432
+ session "Use deep"
433
+ context: deep_analysis
434
+ ```
435
+
436
+ **Why it's bad**: All three analyses run even though only one is used.
437
+
438
+ **Fix**: Compute lazily:
439
+
440
+ ```prose
441
+ # Good: Only compute what's needed
442
+ let initial = session "Initial assessment"
443
+ model: haiku
444
+
445
+ choice **appropriate depth based on initial assessment**:
446
+ option "Simple":
447
+ session "Simple analysis"
448
+ model: haiku
449
+ option "Detailed":
450
+ session "Detailed analysis"
451
+ model: sonnet
452
+ option "Deep":
453
+ session "Deep analysis"
454
+ model: opus
455
+ ```
456
+
457
+ #### over-parallelization
458
+
459
+ Parallelizing so aggressively that overhead dominates or resources are exhausted.
460
+
461
+ ```prose
462
+ # Bad: 100 parallel sessions
463
+ parallel for item in large_collection: # 100 items
464
+ session "Process {item}"
465
+ ```
466
+
467
+ **Why it's bad**: May overwhelm the system. Coordination overhead can exceed parallelism benefits.
468
+
469
+ **Fix**: Batch or limit concurrency:
470
+
471
+ ```prose
472
+ # Good: Process in batches
473
+ for batch in batches(large_collection, 10):
474
+ parallel for item in batch:
475
+ session "Process {item}"
476
+ ```
477
+
478
+ #### premature-parallelization
479
+
480
+ Parallelizing tiny tasks where sequential would be simpler and fast enough.
481
+
482
+ ```prose
483
+ # Bad: Parallel overkill for simple tasks
484
+ parallel:
485
+ a = session "Add 2 + 2"
486
+ b = session "Add 3 + 3"
487
+ c = session "Add 4 + 4"
488
+ ```
489
+
490
+ **Why it's bad**: Coordination overhead exceeds task time. Sequential would be simpler and possibly faster.
491
+
492
+ **Fix**: Keep it simple:
493
+
494
+ ```prose
495
+ # Good: Sequential for trivial tasks
496
+ session "Add 2+2, 3+3, and 4+4"
497
+ ```
498
+
499
+ #### synchronous-fire-and-forget
500
+
501
+ Waiting for operations whose results you don't need.
502
+
503
+ ```prose
504
+ # Bad: Waiting for logging
505
+ session "Do important work"
506
+ session "Log the result" # Don't need to wait for this
507
+ session "Continue with next important work"
508
+ ```
509
+
510
+ **Why it's bad**: Main workflow blocked by non-critical operation.
511
+
512
+ **Fix**: Use appropriate patterns for fire-and-forget operations, or batch logging:
513
+
514
+ ```prose
515
+ # Better: Batch non-critical work
516
+ session "Do important work"
517
+ session "Continue with next important work"
518
+ # ... more important work ...
519
+
520
+ # Log everything at the end or async
521
+ session "Log all operations"
522
+ ```
523
+
524
+ ---
525
+
526
+ ## Maintainability Antipatterns
527
+
528
+ #### magic-strings
529
+
530
+ Hardcoded prompts repeated throughout the program.
531
+
532
+ ```prose
533
+ # Bad: Same prompt in multiple places
534
+ session "You are a helpful assistant. Analyze this code for bugs."
535
+ # ... later ...
536
+ session "You are a helpful assistant. Analyze this code for bugs."
537
+ # ... even later ...
538
+ session "You are a helpful assistent. Analyze this code for bugs." # Typo!
539
+ ```
540
+
541
+ **Why it's bad**: Inconsistency when updating. Typos go unnoticed.
542
+
543
+ **Fix**: Use agents:
544
+
545
+ ```prose
546
+ # Good: Single source of truth
547
+ agent code-analyst:
548
+ model: sonnet
549
+ prompt: "You are a helpful assistant. Analyze code for bugs."
550
+
551
+ session: code-analyst
552
+ prompt: "Analyze the auth module"
553
+ session: code-analyst
554
+ prompt: "Analyze the payment module"
555
+ ```
556
+
557
+ #### opaque-workflow
558
+
559
+ No structure or comments indicating what's happening.
560
+
561
+ ```prose
562
+ # Bad: What is this doing?
563
+ let x = session "A"
564
+ let y = session "B"
565
+ context: x
566
+ parallel:
567
+ z = session "C"
568
+ context: y
569
+ w = session "D"
570
+ session "E"
571
+ context: [z, w]
572
+ ```
573
+
574
+ **Why it's bad**: Impossible to understand, debug, or modify.
575
+
576
+ **Fix**: Use meaningful names and structure:
577
+
578
+ ```prose
579
+ # Good: Clear intent
580
+ # Phase 1: Research
581
+ let research = session "Gather background information"
582
+
583
+ # Phase 2: Analysis
584
+ let analysis = session "Analyze research findings"
585
+ context: research
586
+
587
+ # Phase 3: Parallel evaluation
588
+ parallel:
589
+ technical_eval = session "Technical feasibility assessment"
590
+ context: analysis
591
+ business_eval = session "Business viability assessment"
592
+ context: analysis
593
+
594
+ # Phase 4: Synthesis
595
+ session "Create final recommendation"
596
+ context: { technical_eval, business_eval }
597
+ ```
598
+
599
+ #### implicit-dependencies
600
+
601
+ Relying on conversation history rather than explicit context.
602
+
603
+ ```prose
604
+ # Bad: Implicit state
605
+ session "Set the project name to Acme"
606
+ session "Set the deadline to Friday"
607
+ session "Now create a project plan" # Hopes previous info is remembered
608
+ ```
609
+
610
+ **Why it's bad**: Relies on VM implementation details. Fragile across refactoring.
611
+
612
+ **Fix**: Explicit context:
613
+
614
+ ```prose
615
+ # Good: Explicit state
616
+ let config = session "Define project: name=Acme, deadline=Friday"
617
+
618
+ session "Create a project plan"
619
+ context: config
620
+ ```
621
+
622
+ #### mixed-concerns-agent
623
+
624
+ Agents with prompts that cover too many responsibilities.
625
+
626
+ ```prose
627
+ # Bad: Jack of all trades
628
+ agent super-agent:
629
+ model: opus
630
+ prompt: """
631
+ You are an expert in:
632
+ - Security analysis
633
+ - Performance optimization
634
+ - Code review
635
+ - Documentation
636
+ - Testing
637
+ - DevOps
638
+ - Project management
639
+ - Customer communication
640
+ When asked, perform any of these tasks.
641
+ """
642
+ ```
643
+
644
+ **Why it's bad**: No focus means mediocre results across the board. Can't optimize model choice.
645
+
646
+ **Fix**: Specialized agents:
647
+
648
+ ```prose
649
+ # Good: Focused expertise
650
+ agent security-expert:
651
+ model: sonnet
652
+ prompt: "You are a security analyst. Focus only on security concerns."
653
+
654
+ agent performance-expert:
655
+ model: sonnet
656
+ prompt: "You are a performance engineer. Focus only on optimization."
657
+
658
+ agent technical-writer:
659
+ model: haiku
660
+ prompt: "You write clear technical documentation."
661
+ ```
662
+
663
+ ---
664
+
665
+ ## Logic Antipatterns
666
+
667
+ #### infinite-refinement
668
+
669
+ Loops that can never satisfy their exit condition.
670
+
671
+ ```prose
672
+ # Bad: Perfection is impossible
673
+ loop until **the code has zero bugs**:
674
+ session "Find and fix bugs"
675
+ ```
676
+
677
+ **Why it's bad**: Zero bugs is unachievable. Loop runs until max (if specified) or forever.
678
+
679
+ **Fix**: Use achievable conditions:
680
+
681
+ ```prose
682
+ # Good: Achievable condition
683
+ loop until **all known bugs are fixed** (max: 20):
684
+ session "Find and fix the next bug"
685
+
686
+ # Or: Diminishing returns
687
+ loop until **no significant bugs found in last iteration** (max: 10):
688
+ session "Search for bugs"
689
+ ```
690
+
691
+ #### assertion-as-action
692
+
693
+ Using conditions as actions—checking something without acting on the result.
694
+
695
+ ```prose
696
+ # Bad: Check but don't use result
697
+ session "Check if the system is healthy"
698
+ session "Deploy to production" # Deploys regardless!
699
+ ```
700
+
701
+ **Why it's bad**: The health check result isn't used. Deploy happens unconditionally.
702
+
703
+ **Fix**: Use conditional execution:
704
+
705
+ ```prose
706
+ # Good: Act on the check
707
+ let health = session "Check if the system is healthy"
708
+
709
+ if **system is healthy**:
710
+ session "Deploy to production"
711
+ else:
712
+ session "Alert on-call and skip deployment"
713
+ context: health
714
+ ```
715
+
716
+ #### false-parallelism
717
+
718
+ Putting sequential-dependent operations in a parallel block.
719
+
720
+ ```prose
721
+ # Bad: These aren't independent!
722
+ parallel:
723
+ data = session "Fetch data"
724
+ processed = session "Process the data" # Needs data!
725
+ context: data
726
+ stored = session "Store processed data" # Needs processed!
727
+ context: processed
728
+ ```
729
+
730
+ **Why it's bad**: Despite being in parallel, these must run sequentially due to dependencies.
731
+
732
+ **Fix**: Be honest about dependencies:
733
+
734
+ ```prose
735
+ # Good: Sequential where needed
736
+ let data = session "Fetch data"
737
+ let processed = session "Process the data"
738
+ context: data
739
+ session "Store processed data"
740
+ context: processed
741
+ ```
742
+
743
+ #### exception-as-flow-control
744
+
745
+ Using try/catch for expected conditions rather than exceptional errors.
746
+
747
+ ```prose
748
+ # Bad: Exceptions for normal flow
749
+ try:
750
+ session "Find the optional config file"
751
+ catch:
752
+ session "Use default configuration"
753
+ ```
754
+
755
+ **Why it's bad**: Missing config is expected, not exceptional. Obscures actual errors.
756
+
757
+ **Fix**: Use conditionals for expected cases:
758
+
759
+ ```prose
760
+ # Good: Conditional for expected case
761
+ let config_exists = session "Check if config file exists"
762
+
763
+ if **config file exists**:
764
+ session "Load configuration from file"
765
+ else:
766
+ session "Use default configuration"
767
+ ```
768
+
769
+ ---
770
+
771
+ ## Security Antipatterns
772
+
773
+ #### unvalidated-input
774
+
775
+ Passing external input directly to sessions without validation.
776
+
777
+ ```prose
778
+ # Bad: Direct injection
779
+ let user_input = external_source
780
+
781
+ session "Execute this command: {user_input}"
782
+ ```
783
+
784
+ **Why it's bad**: User could inject malicious prompts or commands.
785
+
786
+ **Fix**: Validate and sanitize:
787
+
788
+ ```prose
789
+ # Good: Validate first
790
+ let user_input = external_source
791
+ let validated = session "Validate this input is a safe search query"
792
+ context: user_input
793
+
794
+ if **input is valid and safe**:
795
+ session "Search for: {validated}"
796
+ else:
797
+ throw "Invalid input rejected"
798
+ ```
799
+
800
+ #### overprivileged-agents
801
+
802
+ Agents with more permissions than they need.
803
+
804
+ ```prose
805
+ # Bad: Full access for simple task
806
+ agent file-reader:
807
+ permissions:
808
+ read: ["**/*"]
809
+ write: ["**/*"]
810
+ bash: allow
811
+ network: allow
812
+
813
+ session: file-reader
814
+ prompt: "Read the README.md file"
815
+ ```
816
+
817
+ **Why it's bad**: Task only needs to read one file but has full system access.
818
+
819
+ **Fix**: Least privilege:
820
+
821
+ ```prose
822
+ # Good: Minimal permissions
823
+ agent file-reader:
824
+ permissions:
825
+ read: ["README.md"]
826
+ write: []
827
+ bash: deny
828
+ network: deny
829
+ ```
830
+
831
+ ---
832
+
833
+ ## Summary
834
+
835
+ Antipatterns emerge from:
836
+
837
+ 1. **Laziness**: Copy-paste instead of abstraction, implicit instead of explicit
838
+ 2. **Over-engineering**: Parallelizing everything, using opus for all tasks
839
+ 3. **Under-engineering**: No error handling, unbounded loops, vague conditions
840
+ 4. **Unclear thinking**: God sessions, mixed concerns, spaghetti context
841
+
842
+ When reviewing OpenProse programs, ask:
843
+
844
+ - Can independent work be parallelized?
845
+ - Are loops bounded?
846
+ - Are errors handled?
847
+ - Is context minimal and explicit?
848
+ - Are models matched to task complexity?
849
+ - Are agents focused and reusable?
850
+ - Would a stranger understand this code?
851
+
852
+ Fix antipatterns early. They compound over time into unmaintainable systems.