@a-company/paradigm 1.5.0

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 (114) hide show
  1. package/README.md +142 -0
  2. package/dist/accept-orchestration-CWZNCGZX.js +188 -0
  3. package/dist/agents-suggest-35LIQKDH.js +83 -0
  4. package/dist/aggregate-W7Q6VIM2.js +88 -0
  5. package/dist/auto-IU7VN55K.js +470 -0
  6. package/dist/beacon-B47XSTL7.js +251 -0
  7. package/dist/chunk-2M6OSOIG.js +1302 -0
  8. package/dist/chunk-4NCFWYGG.js +110 -0
  9. package/dist/chunk-5C4SGQKH.js +705 -0
  10. package/dist/chunk-5GOA7WYD.js +1095 -0
  11. package/dist/chunk-5JGJACDU.js +37 -0
  12. package/dist/chunk-6QC3YGB6.js +114 -0
  13. package/dist/chunk-753RICFF.js +325 -0
  14. package/dist/chunk-AD2LSCHB.js +1595 -0
  15. package/dist/chunk-CHSHON3O.js +669 -0
  16. package/dist/chunk-ELLR7WP6.js +3175 -0
  17. package/dist/chunk-ILOWBJRC.js +12 -0
  18. package/dist/chunk-IRKUEJVW.js +405 -0
  19. package/dist/chunk-MC7XC7XQ.js +533 -0
  20. package/dist/chunk-MO4EEYFW.js +38 -0
  21. package/dist/chunk-MQWH7PFI.js +13366 -0
  22. package/dist/chunk-N6PJAPDE.js +364 -0
  23. package/dist/chunk-PBHIFAL4.js +259 -0
  24. package/dist/chunk-PMXRGPRQ.js +305 -0
  25. package/dist/chunk-PW2EXJQT.js +689 -0
  26. package/dist/chunk-TAP5N3HH.js +245 -0
  27. package/dist/chunk-THFVK5AE.js +148 -0
  28. package/dist/chunk-UM54F7G5.js +1533 -0
  29. package/dist/chunk-UUZ2DMG5.js +185 -0
  30. package/dist/chunk-WS5KM7OL.js +780 -0
  31. package/dist/chunk-YDNKXH4Z.js +2316 -0
  32. package/dist/chunk-YO6DVTL7.js +99 -0
  33. package/dist/claude-SUYNN72C.js +362 -0
  34. package/dist/claude-cli-OF43XAO3.js +276 -0
  35. package/dist/claude-code-PW6SKD2M.js +126 -0
  36. package/dist/claude-code-teams-JLZ5IXB6.js +199 -0
  37. package/dist/constellation-K3CIQCHI.js +225 -0
  38. package/dist/cost-AEK6R7HK.js +174 -0
  39. package/dist/cost-KYXIQ62X.js +93 -0
  40. package/dist/cursor-cli-IHJMPRCW.js +269 -0
  41. package/dist/cursorrules-KI5QWHIX.js +84 -0
  42. package/dist/diff-AJJ5H6HV.js +125 -0
  43. package/dist/dist-7MPIRMTZ-IOQOREMZ.js +10866 -0
  44. package/dist/dist-NHJQVVUW.js +68 -0
  45. package/dist/dist-ZEMSQV74.js +20 -0
  46. package/dist/doctor-6Y6L6HEB.js +11 -0
  47. package/dist/echo-VYZW3OTT.js +248 -0
  48. package/dist/export-R4FJ5NOH.js +38 -0
  49. package/dist/history-EVO3L6SC.js +277 -0
  50. package/dist/hooks-MBWE4ILT.js +12 -0
  51. package/dist/index.d.ts +2 -0
  52. package/dist/index.js +568 -0
  53. package/dist/lint-HXKTWRNO.js +316 -0
  54. package/dist/manual-Y3QOXWYA.js +204 -0
  55. package/dist/mcp.js +14745 -0
  56. package/dist/orchestrate-4ZH5GUQH.js +323 -0
  57. package/dist/probe-OYCP4JYG.js +151 -0
  58. package/dist/promote-Z52ZJTJU.js +181 -0
  59. package/dist/providers-4PGPZEWP.js +104 -0
  60. package/dist/remember-6VZ74B7E.js +77 -0
  61. package/dist/ripple-SBQOSTZD.js +215 -0
  62. package/dist/sentinel-LCFD56OJ.js +43 -0
  63. package/dist/server-F5ITNK6T.js +9846 -0
  64. package/dist/server-T6WIFYRQ.js +16076 -0
  65. package/dist/setup-DF4F3ICN.js +25 -0
  66. package/dist/setup-JHBPZAG7.js +296 -0
  67. package/dist/shift-HKIAP4ZN.js +226 -0
  68. package/dist/snapshot-GTVPRYZG.js +62 -0
  69. package/dist/spawn-BJRQA2NR.js +196 -0
  70. package/dist/summary-H6J6N6PJ.js +140 -0
  71. package/dist/switch-6EANJ7O6.js +232 -0
  72. package/dist/sync-BEOCW7TZ.js +11 -0
  73. package/dist/team-NWP2KJAB.js +32 -0
  74. package/dist/test-MA5TWJQV.js +934 -0
  75. package/dist/thread-JCJVRUQR.js +258 -0
  76. package/dist/triage-ETVXXFMV.js +1880 -0
  77. package/dist/tutorial-L5Q3ZDHK.js +666 -0
  78. package/dist/university-R2WDQLSI.js +40 -0
  79. package/dist/upgrade-5B3YGGC6.js +550 -0
  80. package/dist/validate-F3YHBCRZ.js +39 -0
  81. package/dist/validate-QEEY6KFS.js +64 -0
  82. package/dist/watch-4LT4O6K7.js +123 -0
  83. package/dist/watch-6IIWPWDN.js +111 -0
  84. package/dist/wisdom-LRM4FFCH.js +319 -0
  85. package/package.json +68 -0
  86. package/templates/paradigm/config.yaml +175 -0
  87. package/templates/paradigm/docs/commands.md +727 -0
  88. package/templates/paradigm/docs/decisions/000-template.md +47 -0
  89. package/templates/paradigm/docs/decisions/README.md +26 -0
  90. package/templates/paradigm/docs/error-patterns.md +215 -0
  91. package/templates/paradigm/docs/patterns.md +358 -0
  92. package/templates/paradigm/docs/queries.md +200 -0
  93. package/templates/paradigm/docs/troubleshooting.md +477 -0
  94. package/templates/paradigm/echoes.yaml +25 -0
  95. package/templates/paradigm/prompts/add-feature.md +152 -0
  96. package/templates/paradigm/prompts/add-gate.md +117 -0
  97. package/templates/paradigm/prompts/debug-auth.md +174 -0
  98. package/templates/paradigm/prompts/implement-ftux.md +722 -0
  99. package/templates/paradigm/prompts/implement-sandbox.md +651 -0
  100. package/templates/paradigm/prompts/read-docs.md +84 -0
  101. package/templates/paradigm/prompts/refactor.md +106 -0
  102. package/templates/paradigm/prompts/run-e2e-tests.md +340 -0
  103. package/templates/paradigm/prompts/trace-flow.md +202 -0
  104. package/templates/paradigm/prompts/validate-portals.md +279 -0
  105. package/templates/paradigm/specs/context-tracking.md +200 -0
  106. package/templates/paradigm/specs/context.md +461 -0
  107. package/templates/paradigm/specs/disciplines.md +413 -0
  108. package/templates/paradigm/specs/history.md +339 -0
  109. package/templates/paradigm/specs/logger.md +303 -0
  110. package/templates/paradigm/specs/navigator.md +236 -0
  111. package/templates/paradigm/specs/purpose.md +265 -0
  112. package/templates/paradigm/specs/scan.md +177 -0
  113. package/templates/paradigm/specs/symbols.md +451 -0
  114. package/templates/paradigm/specs/wisdom.md +294 -0
@@ -0,0 +1,339 @@
1
+ # History System Specification
2
+
3
+ > **Paradigm v1.1** | Implementation log, validation, fragility tracking
4
+
5
+ ## Overview
6
+
7
+ The History system captures the **temporal and empirical dimension** of development - what was implemented, what worked, what was rolled back, and how stable different areas are over time. It's the project's memory, indexed by Paradigm symbols.
8
+
9
+ ## Purpose
10
+
11
+ - **Track what changed** - append-only log of implementations, validations, rollbacks
12
+ - **Identify fragile areas** - symbols with frequent failures or rollbacks need extra care
13
+ - **Detect co-change patterns** - symbols that often change together
14
+ - **Guide AI agents** - check stability before modifying risky areas
15
+ - **Enable post-mortems** - full history for any symbol
16
+
17
+ ## Storage Structure
18
+
19
+ ```
20
+ .paradigm/history/
21
+ ├── log.jsonl # Append-only implementation log
22
+ ├── index.yaml # Pre-computed symbol index (regenerated)
23
+ └── validation.yaml # Validation config + summary
24
+ ```
25
+
26
+ ## Schema: log.jsonl
27
+
28
+ Append-only, one JSON object per line. Never edit - only append.
29
+
30
+ ```jsonl
31
+ {"id":"h0001","ts":"2026-02-02T10:00:00Z","type":"implement","symbols":["#checkout"],"author":{"type":"agent","id":"builder"},"commit":"abc123","intent":"feature","files":["src/checkout/page.tsx"],"description":"Added Apple Pay support"}
32
+ {"id":"h0002","ts":"2026-02-02T10:30:00Z","type":"validate","ref":"h0001","symbols":[],"author":{"type":"agent","id":"tester"},"result":"pass","tests":{"passed":15,"failed":0}}
33
+ {"id":"h0003","ts":"2026-02-03T09:00:00Z","type":"rollback","ref":"h0001","symbols":["#checkout"],"author":{"type":"human","id":"alice"},"reason":"Performance regression on mobile"}
34
+ ```
35
+
36
+ ### Entry Types
37
+
38
+ | Type | Description |
39
+ |------|-------------|
40
+ | `implement` | New feature, bug fix, or change |
41
+ | `validate` | Test results for an implementation |
42
+ | `rollback` | Reverting a previous change |
43
+ | `refactor` | Code restructuring without behavior change |
44
+
45
+ ### Fields
46
+
47
+ | Field | Type | Description |
48
+ |-------|------|-------------|
49
+ | `id` | string | Unique ID (h0001, h0002, ...) |
50
+ | `ts` | string | ISO timestamp |
51
+ | `type` | string | Entry type (implement/validate/rollback/refactor) |
52
+ | `symbols` | string[] | Affected Paradigm symbols |
53
+ | `author` | object | `{type: "human"|"agent", id: string}` |
54
+ | `commit` | string? | Git commit hash |
55
+ | `intent` | string? | feature/fix/refactor/experimental/confirmed |
56
+ | `files` | string[]? | Affected files |
57
+ | `description` | string? | What was done |
58
+ | `ref` | string? | Reference to related entry (for validate/rollback) |
59
+ | `result` | string? | pass/fail/partial (for validate) |
60
+ | `tests` | object? | `{passed, failed, skipped}` (for validate) |
61
+ | `reason` | string? | Reason for rollback |
62
+
63
+ ## Schema: index.yaml
64
+
65
+ Pre-computed from log.jsonl. Regenerate with `paradigm history reindex`.
66
+
67
+ ```yaml
68
+ version: "1.0"
69
+ generated: "2026-02-02T12:00:00Z"
70
+
71
+ by_symbol:
72
+ "#checkout":
73
+ symbol: "#checkout"
74
+ total_changes: 45
75
+ last_modified: "2026-02-02T10:00:00Z"
76
+ stability_score: 0.87 # 0.0-1.0, higher is better
77
+ fragility: low # low | medium | high | critical
78
+ recent:
79
+ - id: h0045
80
+ type: implement
81
+ description: "Added Apple Pay"
82
+ ts: "2026-02-02T10:00:00Z"
83
+ # ... last 5 entries
84
+ contributors:
85
+ human: ["alice", "bob"]
86
+ agent: ["builder", "fixer"]
87
+
88
+ "#search":
89
+ symbol: "#search"
90
+ total_changes: 23
91
+ last_modified: "2026-01-28T15:00:00Z"
92
+ stability_score: 0.62
93
+ fragility: high
94
+ recent: [...]
95
+ contributors:
96
+ human: ["carol"]
97
+ agent: ["builder"]
98
+
99
+ co_changes:
100
+ - symbols: ["#checkout", "#payment-form"]
101
+ frequency: 15 # Changed together 15 times
102
+ correlation: 0.89 # 89% of #checkout changes include #payment-form
103
+
104
+ - symbols: ["#search", "#search-index"]
105
+ frequency: 12
106
+ correlation: 0.78
107
+
108
+ fragile_symbols:
109
+ - symbol: "#search"
110
+ fragility: high
111
+ reason: "3 rollbacks in last 10 changes"
112
+
113
+ - symbol: "#legacy-api"
114
+ fragility: critical
115
+ reason: "Stability score 0.41, 5 failures in last month"
116
+ ```
117
+
118
+ ## Schema: validation.yaml
119
+
120
+ ```yaml
121
+ version: "1.0"
122
+ last_run: "2026-02-02T11:00:00Z"
123
+ total_validations: 156
124
+ pass_rate: 0.92
125
+
126
+ by_symbol:
127
+ "#checkout":
128
+ symbol: "#checkout"
129
+ last_validated: "2026-02-02T10:30:00Z"
130
+ last_result: pass
131
+ pass_count: 45
132
+ fail_count: 3
133
+ coverage: 0.87
134
+
135
+ "#search":
136
+ symbol: "#search"
137
+ last_validated: "2026-01-28T16:00:00Z"
138
+ last_result: fail
139
+ pass_count: 18
140
+ fail_count: 5
141
+ coverage: 0.72
142
+ ```
143
+
144
+ ## Fragility Scoring
145
+
146
+ Stability score is calculated from:
147
+
148
+ ```
149
+ base = 1.0
150
+ penalty_per_rollback = 0.20
151
+ penalty_per_failure = 0.10
152
+ normalized_changes = total_changes / 10
153
+
154
+ stability = max(0, base - (rollbacks * 0.20 + failures * 0.10) / max(1, normalized_changes))
155
+ ```
156
+
157
+ Fragility levels:
158
+
159
+ | Score | Level | Meaning |
160
+ |-------|-------|---------|
161
+ | 0.85+ | low | Safe to modify |
162
+ | 0.70-0.85 | medium | Moderate care needed |
163
+ | 0.50-0.70 | high | Extra testing recommended |
164
+ | <0.50 | critical | Consider deferring or extensive review |
165
+
166
+ ## MCP Resources
167
+
168
+ | URI | Description |
169
+ |-----|-------------|
170
+ | `paradigm://history/symbol/{symbol}` | Full history for a symbol |
171
+ | `paradigm://history/symbol/{symbol}/recent` | Last 5 changes only |
172
+ | `paradigm://history/fragile` | List of fragile symbols |
173
+ | `paradigm://history/cochanges/{symbol}` | Co-change patterns |
174
+ | `paradigm://history/validation/summary` | Validation statistics |
175
+
176
+ ## MCP Tools
177
+
178
+ ### paradigm_history_context
179
+
180
+ Get history before modifying symbols.
181
+
182
+ ```json
183
+ {
184
+ "name": "paradigm_history_context",
185
+ "arguments": {
186
+ "symbols": ["#checkout", "#payment-form"]
187
+ }
188
+ }
189
+ ```
190
+
191
+ **Returns:** Summary, recent changes, contributors, co-change patterns for each symbol.
192
+
193
+ ### paradigm_history_record
194
+
195
+ Record an implementation event.
196
+
197
+ ```json
198
+ {
199
+ "name": "paradigm_history_record",
200
+ "arguments": {
201
+ "type": "implement",
202
+ "symbols": ["#checkout"],
203
+ "intent": "feature",
204
+ "description": "Added Apple Pay support",
205
+ "commit": "abc123",
206
+ "files": ["src/checkout/page.tsx"]
207
+ }
208
+ }
209
+ ```
210
+
211
+ ### paradigm_history_validate
212
+
213
+ Record test results.
214
+
215
+ ```json
216
+ {
217
+ "name": "paradigm_history_validate",
218
+ "arguments": {
219
+ "implementation_id": "h0045",
220
+ "result": "pass",
221
+ "tests": {"passed": 15, "failed": 0}
222
+ }
223
+ }
224
+ ```
225
+
226
+ ### paradigm_history_fragility
227
+
228
+ Check fragility before modifying.
229
+
230
+ ```json
231
+ {
232
+ "name": "paradigm_history_fragility",
233
+ "arguments": {
234
+ "symbols": ["#search", "#checkout"]
235
+ }
236
+ }
237
+ ```
238
+
239
+ **Returns:** Fragility levels, warnings, recommendations.
240
+
241
+ ## CLI Commands
242
+
243
+ ```bash
244
+ # Show history overview
245
+ paradigm history
246
+
247
+ # Show history for a symbol
248
+ paradigm history show #checkout
249
+
250
+ # Initialize history directory
251
+ paradigm history init
252
+
253
+ # Show fragile symbols
254
+ paradigm history fragile
255
+
256
+ # Regenerate index from log
257
+ paradigm history reindex
258
+
259
+ # Record an implementation
260
+ paradigm history record \
261
+ --type implement \
262
+ --symbols "#checkout" \
263
+ --description "Added Apple Pay" \
264
+ --intent feature
265
+
266
+ # Record validation result
267
+ paradigm history validate \
268
+ --result pass \
269
+ --ref h0045 \
270
+ --passed 15 \
271
+ --failed 0
272
+ ```
273
+
274
+ ## Git Hooks
275
+
276
+ Automatic history capture via git hooks.
277
+
278
+ ```bash
279
+ # Install hooks
280
+ paradigm hooks install
281
+
282
+ # Hooks installed:
283
+ # - post-commit: Records implementation entries from commits
284
+ # - pre-push: Reindexes history
285
+ ```
286
+
287
+ Post-commit hook extracts:
288
+ - Symbols from .purpose files in changed directories
289
+ - Intent from commit message prefix (feat/fix/refactor)
290
+ - Files changed
291
+ - Commit hash and author
292
+
293
+ ## Agent Workflow
294
+
295
+ Before modifying code, AI agents should:
296
+
297
+ 1. **Check fragility** for symbols they're modifying
298
+ 2. **Review recent history** - what changed, what broke
299
+ 3. **Note co-change patterns** - related symbols may need updates
300
+ 4. **After implementing**, record the change
301
+
302
+ Example:
303
+
304
+ ```
305
+ Agent: "I need to modify #search to add filters"
306
+
307
+ 1. Call paradigm_history_fragility(symbols: ["#search"])
308
+ → fragility: "high"
309
+ → reason: "3 rollbacks in last 10 changes"
310
+ → recommendation: "Add extra test coverage"
311
+
312
+ 2. Call paradigm_history_context(symbols: ["#search"])
313
+ → Recent: 2 rollbacks, 1 performance issue
314
+ → Co-changes: often changes with #search-index
315
+ → Contributors: carol (human), builder (agent)
316
+
317
+ 3. Implement with extra care, add comprehensive tests
318
+
319
+ 4. After commit, call paradigm_history_record(...)
320
+
321
+ 5. After tests pass, call paradigm_history_validate(...)
322
+ ```
323
+
324
+ ## Best Practices
325
+
326
+ 1. **Always record** - even failed attempts provide learning
327
+ 2. **Check fragility first** - before modifying unknown areas
328
+ 3. **Respect co-change patterns** - if A often changes with B, check B
329
+ 4. **Reindex periodically** - after batch operations
330
+ 5. **Review fragile symbols** - in sprint planning
331
+
332
+ ## Token Cost Optimization
333
+
334
+ - Fragility check: ~50-80 tokens
335
+ - Symbol history (recent only): ~100-150 tokens
336
+ - Full history: ~200-400 tokens
337
+ - Co-change patterns: ~50-100 tokens
338
+
339
+ Pre-computed index.yaml avoids scanning full log.
@@ -0,0 +1,303 @@
1
+ # Paradigm Logger Specification (v2)
2
+
3
+ The Paradigm Logger creates a **shared language between code, developers, and AI agents** using Paradigm's symbol system v2. It replaces raw `console.log`/`print` statements with structured, filterable, symbol-typed logs.
4
+
5
+ ---
6
+
7
+ ## Core Principle
8
+
9
+ **NEVER use raw logging. ALWAYS use the Paradigm logger.**
10
+
11
+ ```
12
+ // BAD - Raw logging
13
+ console.log('User logged in', userId);
14
+ print(f"Query took {duration}ms")
15
+
16
+ // GOOD - Paradigm logger (v2)
17
+ log.component('#login-handler').info('User logged in', { userId });
18
+ log.component('#database').debug('Query executed', { duration });
19
+ ```
20
+
21
+ ---
22
+
23
+ ## API Design (v2 - Language-Agnostic)
24
+
25
+ ### Logger Object
26
+
27
+ ```
28
+ log.component('#symbol') → SymbolLogger // For #components (universal code units)
29
+ log.gate('^symbol') → SymbolLogger // For ^gates (authorization)
30
+ log.signal('!symbol') → SymbolLogger // For !signals (events)
31
+ log.flow('$symbol') → SymbolLogger // For $flows (multi-step processes)
32
+ log.aspect('~symbol') → SymbolLogger // For ~aspects (cross-cutting rules)
33
+ log.raw('symbol') → SymbolLogger // For any symbol without prefix validation
34
+ ```
35
+
36
+ ### SymbolLogger Methods
37
+
38
+ ```
39
+ .debug(message, data?) // Verbose debugging info
40
+ .info(message, data?) // General information
41
+ .warn(message, data?) // Warning conditions
42
+ .error(message, data?) // Error conditions
43
+ .start(message, data?) → DurationTracker // Start timed operation
44
+ ```
45
+
46
+ ### DurationTracker Methods
47
+
48
+ ```
49
+ .success(message, data?) // Operation succeeded (logs duration)
50
+ .error(message, data?) // Operation failed (logs duration)
51
+ .end(level, message, data?) // Custom level completion
52
+ ```
53
+
54
+ ---
55
+
56
+ ## Log Levels
57
+
58
+ | Level | Priority | When to Use |
59
+ |-------|----------|-------------|
60
+ | `debug` | 0 | Internal state, cache hits, queries — verbose dev info |
61
+ | `info` | 1 | Component entry/exit, successful operations |
62
+ | `warn` | 2 | Denied access, retries, recoverable issues |
63
+ | `error` | 3 | Exceptions, unrecoverable failures |
64
+
65
+ **Default:** `debug` in development, `info` in production.
66
+
67
+ ---
68
+
69
+ ## Symbol Usage by Location (v2)
70
+
71
+ In v2, all code units use `#component`. The tag system handles classification.
72
+
73
+ | Directory Pattern | Symbol | Log Method |
74
+ |-------------------|--------|------------|
75
+ | `features/`, `routes/`, `api/` | `#` | `log.component()` |
76
+ | `components/`, `lib/`, `utils/` | `#` | `log.component()` |
77
+ | `services/`, `core/`, `drivers/` | `#` | `log.component()` |
78
+ | `integrations/`, `external/`, `vendors/` | `#` | `log.component()` |
79
+ | `stores/`, `state/`, `reducers/` | `#` | `log.component()` |
80
+ | `config/`, `models/` | `#` | `log.component()` |
81
+ | `middleware/`, `auth/`, `guards/`, `policies/` | `^` | `log.gate()` |
82
+ | `events/`, `handlers/`, `listeners/`, `hooks/` | `!` | `log.signal()` |
83
+ | `flows/`, `sagas/`, `workflows/`, `pipelines/` | `$` | `log.flow()` |
84
+ | `aspects/`, `rules/`, `constraints/` | `~` | `log.aspect()` |
85
+
86
+ ---
87
+
88
+ ## Common Patterns
89
+
90
+ ### Component Entry/Exit
91
+
92
+ ```
93
+ function login(email, password):
94
+ tracker = log.component('#login-handler').start('Starting login', { email })
95
+
96
+ try:
97
+ user = authenticate(email, password)
98
+ log.signal('!login-success').info('User authenticated', { userId: user.id })
99
+ tracker.success('Login completed', { userId: user.id })
100
+ return user
101
+ catch error:
102
+ log.signal('!login-failed').warn('Login failed', { email, error })
103
+ tracker.error('Login failed', { error })
104
+ throw error
105
+ ```
106
+
107
+ ### Gate Checks
108
+
109
+ ```
110
+ function requireAuth(request):
111
+ log.gate('^authenticated').debug('Checking gate')
112
+
113
+ user = getUser(request)
114
+ if not user:
115
+ log.gate('^authenticated').warn('Access denied', { path: request.path })
116
+ return unauthorized()
117
+
118
+ log.gate('^authenticated').debug('Gate passed', { userId: user.id })
119
+ return next()
120
+ ```
121
+
122
+ > **Note:** For authorization flows that need AI validation, use the **Portal Validator** instead.
123
+ > See [Portal Validation Specification](./portal-validation.md) for structured decision logging.
124
+
125
+ ### Component Operations
126
+
127
+ ```
128
+ function query(sql, params):
129
+ tracker = log.component('#database').start('Executing query')
130
+
131
+ try:
132
+ result = db.execute(sql, params)
133
+ tracker.success('Query completed', { rows: result.length })
134
+ return result
135
+ catch error:
136
+ tracker.error('Query failed', { error })
137
+ throw error
138
+ ```
139
+
140
+ ### Integration Components
141
+
142
+ ```
143
+ function processPayment(amount, token):
144
+ tracker = log.component('#stripe-client').start('Processing payment', { amount })
145
+
146
+ try:
147
+ result = stripe.charges.create({ amount, source: token })
148
+ log.signal('!payment-completed').info('Payment processed', { chargeId: result.id })
149
+ tracker.success('Payment completed', { chargeId: result.id })
150
+ return result
151
+ catch error:
152
+ log.signal('!payment-failed').error('Payment failed', { error })
153
+ tracker.error('Payment failed', { error })
154
+ throw error
155
+ ```
156
+
157
+ ### Aspect Enforcement
158
+
159
+ ```
160
+ function auditMiddleware(request, next):
161
+ log.aspect('~audit-required').debug('Audit middleware invoked', { path: request.path })
162
+
163
+ before = captureState()
164
+ result = next(request)
165
+ after = captureState()
166
+
167
+ log.aspect('~audit-required').info('Operation audited', {
168
+ path: request.path,
169
+ changes: diff(before, after)
170
+ })
171
+
172
+ return result
173
+ ```
174
+
175
+ ### State Components
176
+
177
+ ```
178
+ function setAuthenticated(value):
179
+ log.component('#user-store').info('State changing', {
180
+ from: state.authenticated,
181
+ to: value
182
+ })
183
+ state.authenticated = value
184
+ ```
185
+
186
+ ---
187
+
188
+ ## Filtering
189
+
190
+ ### By Log Level
191
+
192
+ ```bash
193
+ # Environment variable
194
+ LOG_LEVEL=debug # Show all
195
+ LOG_LEVEL=info # Show info, warn, error
196
+ LOG_LEVEL=warn # Show warn, error
197
+ LOG_LEVEL=error # Show errors only
198
+ ```
199
+
200
+ ### By Symbol Type
201
+
202
+ ```bash
203
+ # Environment variable (comma-separated)
204
+ PARADIGM_SYMBOLS=! # Signals only — high-level overview
205
+ PARADIGM_SYMBOLS=#,^,! # Components, gates, signals — auth debugging
206
+ PARADIGM_SYMBOLS=# # Components only — infrastructure debugging
207
+ PARADIGM_SYMBOLS=~ # Aspects only — rule enforcement debugging
208
+ ```
209
+
210
+ ### Common Filter Recipes
211
+
212
+ | Use Case | Level | Symbols | What You See |
213
+ |----------|-------|---------|--------------|
214
+ | High-level overview | info | `!` | Just events/signals |
215
+ | Auth debugging | debug | `#,^,!` | Components, gates, signals |
216
+ | Infrastructure | debug | `#,!` | Components and signals |
217
+ | Rule enforcement | debug | `~,!` | Aspects and signals |
218
+ | Minimal | warn | (all) | Warnings and errors only |
219
+
220
+ ---
221
+
222
+ ## Output Formats
223
+
224
+ ### Development (Pretty)
225
+
226
+ ```
227
+ 16:42:15.123 #login-handler INFO Starting login {"email":"user@example.com"}
228
+ 16:42:15.456 #database DEBUG Query executed {"table":"users","duration":"45ms"}
229
+ 16:42:15.789 !login-success INFO User authenticated {"userId":"abc123"}
230
+ ```
231
+
232
+ ### Production (JSON)
233
+
234
+ ```json
235
+ {"timestamp":"2026-01-14T00:42:15.123Z","level":"info","symbol":"#login-handler","symbolType":"component","message":"Starting login","email":"user@example.com"}
236
+ ```
237
+
238
+ ---
239
+
240
+ ## Correlation IDs
241
+
242
+ Track requests across multiple log statements:
243
+
244
+ ```
245
+ correlationId = createCorrelationId()
246
+
247
+ withCorrelation(correlationId, () => {
248
+ log.component('#checkout').info('Starting checkout')
249
+ log.component('#payment').info('Processing payment')
250
+ log.signal('!checkout-complete').info('Order placed')
251
+ // All logs include the same correlationId
252
+ })
253
+ ```
254
+
255
+ ---
256
+
257
+ ## Implementation Checklist
258
+
259
+ When implementing the Paradigm logger in a new language:
260
+
261
+ - [ ] Symbol-typed methods: `log.component()`, `log.gate()`, `log.signal()`, `log.flow()`, `log.aspect()`
262
+ - [ ] Log levels: debug, info, warn, error
263
+ - [ ] Duration tracking: `.start()` → `.success()` / `.error()`
264
+ - [ ] Structured data parameter on all methods
265
+ - [ ] Level filtering via environment variable
266
+ - [ ] Symbol filtering via environment variable
267
+ - [ ] Pretty format for development
268
+ - [ ] JSON format for production
269
+ - [ ] Correlation ID support
270
+ - [ ] Timestamp in output
271
+
272
+ ---
273
+
274
+ ## Portal Validation
275
+
276
+ For authorization decisions that need to be validated by AI agents, use the **Portal Validator** alongside the standard logger. The Portal Validator emits structured decision logs:
277
+
278
+ ```
279
+ ┌─────────────────────────────────────────────────────────
280
+ │ 🚪 PORTAL CHECK: ^subscription-required
281
+ │ ├─ Requires: active subscription, trial not exceeded
282
+ │ ├─ Context: { userId: "abc123", plan: "growth" }
283
+ │ ├─ Decision: ✅ ALLOW
284
+ │ └─ Reason: Subscription valid - growth plan active
285
+ └─────────────────────────────────────────────────────────
286
+ ```
287
+
288
+ Use cases:
289
+ - **`log.gate()`** - General gate-related logging and debugging
290
+ - **`portal.check()`** - Authorization decisions that need validation
291
+
292
+ See [Portal Validation Specification](./portal-validation.md) for full details.
293
+
294
+ ---
295
+
296
+ ## Reference Implementations
297
+
298
+ See working implementations in:
299
+ - **TypeScript (Browser):** Pattern with CSS console styling
300
+ - **TypeScript (Node.js):** Pattern with ANSI codes + AsyncLocalStorage
301
+ - **Python:** Pattern with logging module
302
+ - **Go:** Pattern with structured logging
303
+ - **Rust:** Pattern with tracing crate