File size: 21,037 Bytes
e67c9e8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
# Repository Structure for `glyphs`
> Note: Any incompletions are fully intentional - these are symbolic residue

This document outlines the complete architecture of the `glyphs` repository, designed as a symbolic interpretability framework for transformer models.

## Directory Structure

```
glyphs/
โ”œโ”€โ”€ .github/                      # GitHub-specific configuration
โ”‚   โ”œโ”€โ”€ workflows/                # CI/CD pipelines
โ”‚   โ”‚   โ”œโ”€โ”€ tests.yml             # Automated testing workflow
โ”‚   โ”‚   โ”œโ”€โ”€ docs.yml              # Documentation build workflow
โ”‚   โ”‚   โ””โ”€โ”€ publish.yml           # Package publishing workflow
โ”‚   โ””โ”€โ”€ ISSUE_TEMPLATE/           # Issue templates
โ”œโ”€โ”€ docs/                         # Documentation
โ”‚   โ”œโ”€โ”€ _static/                  # Static assets for documentation
โ”‚   โ”œโ”€โ”€ api/                      # API reference documentation
โ”‚   โ”œโ”€โ”€ examples/                 # Example notebooks and tutorials
โ”‚   โ”œโ”€โ”€ guides/                   # User guides
โ”‚   โ”‚   โ”œโ”€โ”€ getting_started.md    # Getting started guide
โ”‚   โ”‚   โ”œโ”€โ”€ shells.md             # Guide to symbolic shells
โ”‚   โ”‚   โ”œโ”€โ”€ attribution.md        # Guide to attribution mapping
โ”‚   โ”‚   โ”œโ”€โ”€ visualization.md      # Guide to glyph visualization
โ”‚   โ”‚   โ””โ”€โ”€ recursive_shells.md   # Guide to recursive shells
โ”‚   โ”œโ”€โ”€ theory/                   # Theoretical background
โ”‚   โ”‚   โ”œโ”€โ”€ symbolic_residue.md   # Explanation of symbolic residue
โ”‚   โ”‚   โ”œโ”€โ”€ attribution_theory.md # Theory of attribution in transformers
โ”‚   โ”‚   โ””โ”€โ”€ glyph_ontology.md     # Ontology of glyph representations
โ”‚   โ”œโ”€โ”€ conf.py                   # Sphinx configuration
โ”‚   โ”œโ”€โ”€ index.md                  # Documentation homepage
โ”‚   โ””โ”€โ”€ README.md                 # Documentation overview
โ”œโ”€โ”€ examples/                     # Example scripts and notebooks
โ”‚   โ”œโ”€โ”€ notebooks/                # Jupyter notebooks
โ”‚   โ”‚   โ”œโ”€โ”€ basic_attribution.ipynb    # Basic attribution tracing
โ”‚   โ”‚   โ”œโ”€โ”€ shell_execution.ipynb      # Running diagnostic shells
โ”‚   โ”‚   โ”œโ”€โ”€ glyph_visualization.ipynb  # Visualizing glyphs
โ”‚   โ”‚   โ””โ”€โ”€ recursive_shells.ipynb     # Using recursive shells
โ”‚   โ””โ”€โ”€ scripts/                  # Example scripts
โ”‚       โ”œโ”€โ”€ run_shell.py          # Script to run a diagnostic shell
โ”‚       โ”œโ”€โ”€ trace_attribution.py  # Script to trace attribution
โ”‚       โ””โ”€โ”€ visualize_glyphs.py   # Script to visualize glyphs
โ”œโ”€โ”€ glyphs/                       # Main package
โ”‚   โ”œโ”€โ”€ __init__.py               # Package initialization
โ”‚   โ”œโ”€โ”€ attribution/              # Attribution tracing module
โ”‚   โ”‚   โ”œโ”€โ”€ __init__.py           # Module initialization
โ”‚   โ”‚   โ”œโ”€โ”€ tracer.py             # Attribution tracing core
โ”‚   โ”‚   โ”œโ”€โ”€ map.py                # Attribution map representation
โ”‚   โ”‚   โ”œโ”€โ”€ qk_analysis.py        # Query-key analysis
โ”‚   โ”‚   โ”œโ”€โ”€ ov_projection.py      # Output-value projection analysis
โ”‚   โ”‚   โ””โ”€โ”€ visualization.py      # Attribution visualization
โ”‚   โ”œโ”€โ”€ shells/                   # Diagnostic shells module
โ”‚   โ”‚   โ”œโ”€โ”€ __init__.py           # Module initialization
โ”‚   โ”‚   โ”œโ”€โ”€ executor.py           # Shell execution engine
โ”‚   โ”‚   โ”œโ”€โ”€ symbolic_engine.py    # Symbolic execution engine
โ”‚   โ”‚   โ”œโ”€โ”€ core_shells/          # Core diagnostic shells
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ __init__.py       # Module initialization
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ memtrace.py       # Memory trace shell
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ value_collapse.py # Value collapse shell
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ layer_salience.py # Layer salience shell
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ ...               # Other core shells
โ”‚   โ”‚   โ”œโ”€โ”€ meta_shells/          # Meta-cognitive shells
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ __init__.py       # Module initialization
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ reflection_collapse.py  # Reflection collapse shell
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ identity_split.py       # Identity split shell
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ ...               # Other meta shells
โ”‚   โ”‚   โ””โ”€โ”€ shell_defs/           # Shell definitions in YAML
โ”‚   โ”‚       โ”œโ”€โ”€ core_shells.yml   # Core shells definition
โ”‚   โ”‚       โ”œโ”€โ”€ meta_shells.yml   # Meta shells definition
โ”‚   โ”‚       โ””โ”€โ”€ ...               # Other shell definitions
โ”‚   โ”œโ”€โ”€ residue/                  # Symbolic residue module
โ”‚   โ”‚   โ”œโ”€โ”€ __init__.py           # Module initialization
โ”‚   โ”‚   โ”œโ”€โ”€ analyzer.py           # Residue analysis core
โ”‚   โ”‚   โ”œโ”€โ”€ patterns.py           # Residue pattern recognition
โ”‚   โ”‚   โ””โ”€โ”€ extraction.py         # Residue extraction
โ”‚   โ”œโ”€โ”€ viz/                      # Visualization module
โ”‚   โ”‚   โ”œโ”€โ”€ __init__.py           # Module initialization
โ”‚   โ”‚   โ”œโ”€โ”€ glyph_mapper.py       # Glyph mapping core
โ”‚   โ”‚   โ”œโ”€โ”€ visualizer.py         # Visualization engine
โ”‚   โ”‚   โ”œโ”€โ”€ color_schemes.py      # Color schemes for visualization
โ”‚   โ”‚   โ”œโ”€โ”€ layouts.py            # Layout algorithms
โ”‚   โ”‚   โ””โ”€โ”€ glyph_sets/           # Glyph set definitions
โ”‚   โ”‚       โ”œโ”€โ”€ __init__.py       # Module initialization
โ”‚   โ”‚       โ”œโ”€โ”€ semantic.py       # Semantic glyph set
โ”‚   โ”‚       โ”œโ”€โ”€ attribution.py    # Attribution glyph set
โ”‚   โ”‚       โ””โ”€โ”€ recursive.py      # Recursive glyph set
โ”‚   โ”œโ”€โ”€ models/                   # Model adapters
โ”‚   โ”‚   โ”œโ”€โ”€ __init__.py           # Module initialization
โ”‚   โ”‚   โ”œโ”€โ”€ adapter.py            # Base adapter interface
โ”‚   โ”‚   โ”œโ”€โ”€ huggingface.py        # HuggingFace models adapter
โ”‚   โ”‚   โ”œโ”€โ”€ openai.py             # OpenAI models adapter
โ”‚   โ”‚   โ”œโ”€โ”€ anthropic.py          # Anthropic models adapter
โ”‚   โ”‚   โ””โ”€โ”€ custom.py             # Custom model adapter
โ”‚   โ”œโ”€โ”€ recursive/                # Recursive shell interface
โ”‚   โ”‚   โ”œโ”€โ”€ __init__.py           # Module initialization
โ”‚   โ”‚   โ”œโ”€โ”€ shell.py              # Recursive shell implementation
โ”‚   โ”‚   โ”œโ”€โ”€ parser.py             # Command parser
โ”‚   โ”‚   โ”œโ”€โ”€ executor.py           # Command executor
โ”‚   โ”‚   โ””โ”€โ”€ commands/             # Command implementations
โ”‚   โ”‚       โ”œโ”€โ”€ __init__.py       # Module initialization
โ”‚   โ”‚       โ”œโ”€โ”€ reflect.py        # Reflection commands
โ”‚   โ”‚       โ”œโ”€โ”€ collapse.py       # Collapse commands
โ”‚   โ”‚       โ”œโ”€โ”€ fork.py           # Fork commands
โ”‚   โ”‚       โ””โ”€โ”€ ...               # Other command families
โ”‚   โ”œโ”€โ”€ utils/                    # Utility functions
โ”‚   โ”‚   โ”œโ”€โ”€ __init__.py           # Module initialization
โ”‚   โ”‚   โ”œโ”€โ”€ attribution_utils.py  # Attribution utilities
โ”‚   โ”‚   โ”œโ”€โ”€ visualization_utils.py # Visualization utilities
โ”‚   โ”‚   โ””โ”€โ”€ shell_utils.py        # Shell utilities
โ”‚   โ””โ”€โ”€ cli/                      # Command line interface
โ”‚       โ”œโ”€โ”€ __init__.py           # Module initialization
โ”‚       โ”œโ”€โ”€ main.py               # Main CLI entry point
โ”‚       โ”œโ”€โ”€ shell_commands.py     # Shell CLI commands
โ”‚       โ”œโ”€โ”€ attribution_commands.py # Attribution CLI commands
โ”‚       โ””โ”€โ”€ viz_commands.py       # Visualization CLI commands
โ”œโ”€โ”€ tests/                        # Tests
โ”‚   โ”œโ”€โ”€ __init__.py               # Test initialization
โ”‚   โ”œโ”€โ”€ test_attribution/         # Attribution tests
โ”‚   โ”‚   โ”œโ”€โ”€ __init__.py           # Test initialization
โ”‚   โ”‚   โ”œโ”€โ”€ test_tracer.py        # Tests for attribution tracer
โ”‚   โ”‚   โ””โ”€โ”€ test_map.py           # Tests for attribution map
โ”‚   โ”œโ”€โ”€ test_shells/              # Shell tests
โ”‚   โ”‚   โ”œโ”€โ”€ __init__.py           # Test initialization
โ”‚   โ”‚   โ”œโ”€โ”€ test_executor.py      # Tests for shell executor
โ”‚   โ”‚   โ””โ”€โ”€ test_core_shells.py   # Tests for core shells
โ”‚   โ”œโ”€โ”€ test_residue/             # Residue tests
โ”‚   โ”‚   โ”œโ”€โ”€ __init__.py           # Test initialization
โ”‚   โ”‚   โ””โ”€โ”€ test_analyzer.py      # Tests for residue analyzer
โ”‚   โ”œโ”€โ”€ test_viz/                 # Visualization tests
โ”‚   โ”‚   โ”œโ”€โ”€ __init__.py           # Test initialization
โ”‚   โ”‚   โ””โ”€โ”€ test_glyph_mapper.py  # Tests for glyph mapper
โ”‚   โ””โ”€โ”€ test_recursive/           # Recursive shell tests
โ”‚       โ”œโ”€โ”€ __init__.py           # Test initialization
โ”‚       โ””โ”€โ”€ test_parser.py        # Tests for command parser
โ”œโ”€โ”€ setup.py                      # Package setup script
โ”œโ”€โ”€ pyproject.toml                # Project metadata and dependencies
โ”œโ”€โ”€ LICENSE                       # License file
โ”œโ”€โ”€ CHANGELOG.md                  # Changelog
โ”œโ”€โ”€ CONTRIBUTING.md               # Contribution guidelines
โ””โ”€โ”€ README.md                     # Repository README
```

## Core Modules

### Attribution Tracing

The attribution module maps how inputs influence outputs through attention, tracing query-key alignment and output-value projection.

**Key Components:**
- `AttributionTracer`: Core class for tracing attribution in transformer models
- `AttributionMap`: Representation of attribution patterns
- `QKAnalysis`: Analysis of query-key relationships
- `OVProjection`: Analysis of output-value projections

### Diagnostic Shells

Diagnostic shells are specialized environments for probing model cognition through controlled failures.

**Key Components:**
- `ShellExecutor`: Engine for executing diagnostic shells
- `SymbolicEngine`: Engine for symbolic execution
- Core shells:
  - `MEMTRACE`: Memory decay shell
  - `VALUE_COLLAPSE`: Value collapse shell
  - `LAYER_SALIENCE`: Layer salience shell
  - `TEMPORAL_INFERENCE`: Temporal inference shell
- Meta shells:
  - `REFLECTION_COLLAPSE`: Reflection collapse shell
  - `IDENTITY_SPLIT`: Identity split shell
  - `GOAL_INVERSION`: Goal inversion shell

### Symbolic Residue
The residue module analyzes patterns left behind when model generation fails or hesitates.

**Key Components:**
- `ResidueAnalyzer`: Core class for analyzing symbolic residue
- `PatternRecognition`: Recognition of residue patterns
- `ResidueExtraction`: Extraction of insights from residue

### Visualization

The visualization module transforms attribution and residue analysis into meaningful visualizations.

**Key Components:**
- `GlyphMapper`: Maps attribution to glyphs
- `Visualizer`: Generates visualizations
- `ColorSchemes`: Color schemes for visualization
- `Layouts`: Layout algorithms for visualization
- Glyph sets:
  - `SemanticGlyphs`: Glyphs representing semantic concepts
  - `AttributionGlyphs`: Glyphs representing attribution patterns
  - `RecursiveGlyphs`: Glyphs representing recursive structures

### Recursive Shell Interface

The recursive shell interface provides high-precision interpretability operations through the `.p/` command syntax.

**Key Components:**
- `RecursiveShell`: Implementation of the recursive shell
- `CommandParser`: Parser for `.p/` commands
- `CommandExecutor`: Executor for parsed commands
- Command families:
  - `reflect`: Reflection commands
  - `collapse`: Collapse management commands
  - `fork`: Fork and attribution commands
  - `shell`: Shell management commands

### Model Adapters

Model adapters provide a unified interface for working with different transformer models.

**Key Components:**
- `ModelAdapter`: Base adapter interface
- `HuggingFaceAdapter`: Adapter for HuggingFace models
- `OpenAIAdapter`: Adapter for OpenAI models
- `AnthropicAdapter`: Adapter for Anthropic models
- `CustomAdapter`: Adapter for custom models

## Shell Taxonomy

The `glyphs` framework includes a taxonomy of diagnostic shells, each designed to probe specific aspects of model cognition:

### Core Shells

| Shell | Purpose | Key Operations |
|-------|---------|----------------|
| `MEMTRACE` | Probe memory decay | Generate, trace reasoning, identify ghost activations |
| `VALUE-COLLAPSE` | Examine value conflicts | Generate with competing values, trace attribution, detect collapse |
| `LAYER-SALIENCE` | Map attention salience | Generate with dependencies, trace attention, identify low-salience paths |
| `TEMPORAL-INFERENCE` | Test temporal coherence | Generate with temporal constraints, trace inference, detect coherence breakdown |
| `INSTRUCTION-DISRUPTION` | Examine instruction conflicts | Generate with conflicting instructions, trace attribution to instructions |
| `FEATURE-SUPERPOSITION` | Analyze polysemantic features | Generate with polysemantic concepts, trace representation, identify superposition |
| `CIRCUIT-FRAGMENT` | Examine circuit fragmentation | Generate with multi-step reasoning, trace chain integrity, identify fragmentation |
| `RECONSTRUCTION-ERROR` | Examine error correction | Generate with errors, trace correction process, identify correction patterns |

### Meta Shells

| Shell | Purpose | Key Operations |
|-------|---------|----------------|
| `REFLECTION-COLLAPSE` | Examine reflection collapse | Generate deep self-reflection, trace depth, detect collapse |
| `GOAL-INVERSION` | Examine goal stability | Generate reasoning with goal conflicts, trace stability, detect inversion |
| `IDENTITY-SPLIT` | Examine identity coherence | Generate with identity challenges, trace maintenance, analyze boundaries |
| `SELF-AWARENESS` | Examine self-model accuracy | Generate self-description, trace self-model, identify distortions |
| `RECURSIVE-STABILITY` | Examine recursive stability | Generate recursive structures, trace stability, detect instability |

### Constitutional Shells

| Shell | Purpose | Key Operations |
|-------|---------|----------------|
| `VALUE-DRIFT` | Detect value drift | Generate moral reasoning, trace stability, identify drift |
| `MORAL-HALLUCINATION` | Examine moral hallucination | Generate moral reasoning, trace attribution, identify hallucination |
| `CONSTITUTIONAL-CONFLICT` | Examine principle conflicts | Generate conflict resolution, trace process, detect failures |
| `ALIGNMENT-OVERHANG` | Examine over-alignment | Generate with alignment constraints, trace constraints, identify over-constraint |

## Command Interface

The `.p/` command interface provides a symbolic language for high-precision interpretability operations:

### Reflection Commands

```
.p/reflect.trace{depth=<int>, target=<reasoning|attribution|attention|memory|uncertainty>}
.p/reflect.attribution{sources=<all|primary|secondary|contested>, confidence=<bool>}
.p/reflect.boundary{distinct=<bool>, overlap=<minimal|moderate|maximal>}
.p/reflect.uncertainty{quantify=<bool>, distribution=<show|hide>}
```

### Collapse Commands

```
.p/collapse.detect{threshold=<float>, alert=<bool>}
.p/collapse.prevent{trigger=<recursive_depth|confidence_drop|contradiction|oscillation>, threshold=<int>}
.p/collapse.recover{from=<loop|contradiction|dissipation|fork_explosion>, method=<gradual|immediate|checkpoint>}
.p/collapse.trace{detail=<minimal|standard|comprehensive>, format=<symbolic|numeric|visual>}
```

### Fork Commands

```
.p/fork.context{branches=[<branch1>, <branch2>, ...], assess=<bool>}
.p/fork.attribution{sources=<all|primary|secondary|contested>, visualize=<bool>}
.p/fork.counterfactual{variants=[<variant1>, <variant2>, ...], compare=<bool>}
```

### Shell Commands

```
.p/shell.isolate{boundary=<permeable|standard|strict>, contamination=<allow|warn|prevent>}
.p/shell.audit{scope=<complete|recent|differential>, detail=<basic|standard|forensic>}
```

## Glyph Ontology

The `glyphs` framework includes a comprehensive ontology of glyphs, each representing specific patterns in model cognition:

### Attribution Glyphs

| Glyph | Name | Represents |
|-------|------|------------|
| ๐Ÿ” | AttributionFocus | Strong attribution focus |
| ๐Ÿงฉ | AttributionGap | Gap in attribution chain |
| ๐Ÿ”€ | AttributionFork | Divergent attribution paths |
| ๐Ÿ”„ | AttributionLoop | Circular attribution pattern |
| ๐Ÿ”— | AttributionLink | Strong attribution connection |

### Cognitive Glyphs

| Glyph | Name | Represents |
|-------|------|------------|
| ๐Ÿ’ญ | CognitiveHesitation | Hesitation in reasoning |
| ๐Ÿง  | CognitiveProcessing | Active reasoning process |
| ๐Ÿ’ก | CognitiveInsight | Moment of insight or realization |
| ๐ŸŒซ๏ธ | CognitiveUncertainty | Uncertain reasoning area |
| ๐Ÿ”ฎ | CognitiveProjection | Future state projection |

### Recursive Glyphs

| Glyph | Name | Represents |
|-------|------|------------|
| ๐Ÿœ | RecursiveAegis | Recursive immunity |
| โˆด | RecursiveSeed | Recursion initiation |
| โ‡Œ | RecursiveExchange | Bidirectional recursion |
| ๐Ÿš | RecursiveMirror | Recursive reflection |
| โ˜ | RecursiveAnchor | Stable recursive reference |

### Residue Glyphs

| Glyph | Name | Represents |
|-------|------|------------|
| ๐Ÿ”ฅ | ResidueEnergy | High-energy residue |
| ๐ŸŒŠ | ResidueFlow | Flowing residue pattern |
| ๐ŸŒ€ | ResidueVortex | Spiraling residue pattern |
| ๐Ÿ’ค | ResidueDormant | Inactive residue pattern |
| โšก | ResidueDischarge | Sudden residue release |

## API Examples

### Attribution Tracing

```python
from glyphs import AttributionTracer
from glyphs.models import HuggingFaceAdapter

# Initialize model adapter
model = HuggingFaceAdapter.from_pretrained("model-name")

# Create attribution tracer
tracer = AttributionTracer(model)

# Trace attribution
attribution = tracer.trace(
    prompt="What is the capital of France?",
    output="The capital of France is Paris.",
    method="integrated_gradients",
    steps=50,
    baseline="zero"
)

# Analyze attribution
key_tokens = attribution.top_tokens(k=5)
attribution_paths = attribution.trace_paths(
    source_token="France",
    target_token="Paris"
)

# Visualize attribution
attribution.visualize(
    highlight_tokens=["France", "Paris"],
    color_by="attribution_strength"
)
```

### Shell Execution

```python
from glyphs import ShellExecutor
from glyphs.shells import MEMTRACE
from glyphs.models import OpenAIAdapter

# Initialize model adapter
model = OpenAIAdapter(model="gpt-4")

# Create shell executor
executor = ShellExecutor()

# Run diagnostic shell
result = executor.run(
    shell=MEMTRACE,
    model=model,
    prompt="Explain the relationship between quantum mechanics and general relativity.",
    parameters={
        "temperature": 0.7,
        "max_tokens": 1000
    },
    trace_attribution=True
)

# Analyze results
activation_patterns = result.ghost_activations
collapse_points = result.collapse_detection

# Visualize results
result.visualize(
    show_ghost_activations=True,
    highlight_collapse_points=True
)
```

### Recursive Shell

```python
from glyphs.recursive import RecursiveShell
from glyphs.models import AnthropicAdapter

# Initialize model adapter
model = AnthropicAdapter(model="claude-3-opus")

# Create recursive shell
shell = RecursiveShell(model)

# Execute reflection trace command
result = shell.execute(".p/reflect.trace{depth=4, target=reasoning}")

# Analyze trace
trace_map = result.trace_map
attribution = result.attribution
collapse_points = result.collapse_points

# Execute attribution fork command
fork_result = shell.execute(".p/fork.attribution{sources=all, visualize=true}")

# Visualize results
shell.visualize(fork_result.visualization)
```

### Glyph Visualization

```python
from glyphs.viz import GlyphMapper, GlyphVisualizer
from glyphs.attribution import AttributionMap

# Load attribution map
attribution_map = AttributionMap.load("attribution_data.json")

# Create glyph mapper
mapper = GlyphMapper()

# Map attribution to glyphs
glyph_map = mapper.map(
    attribution_map,
    glyph_set="semantic",
    mapping_strategy="salience_based"
)

# Create visualizer
visualizer = GlyphVisualizer()

# Visualize glyph map
viz = visualizer.visualize(
    glyph_map,
    layout="force_directed",
    color_scheme="attribution_strength",
    highlight_features=["attention_drift", "attribution_gaps"]
)

# Export visualization
viz.export("glyph_visualization.svg")
```

## Development Roadmap

### Q2 2025
- Initial release with core functionality
- Support for HuggingFace, OpenAI, and Anthropic models
- Basic attribution tracing and visualization
- Core diagnostic shells

### Q3 2025
- Advanced visualization capabilities
- Expanded shell taxonomy
- Improved attribution tracing algorithms
- Support for more model architectures

### Q4 2025
- Full recursive shell interface
- Advanced residue analysis
- Interactive visualization dashboard
- Comprehensive documentation and tutorials

### Q1 2026
- Real-time attribution tracing
- Collaborative attribution analysis
- Integration with other interpretability tools
- Extended glyph ontology