File size: 13,128 Bytes
1b5c6c6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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

}
  {
    "version": "3.0",
    "updated": "2026-01-28",
    "copyright": "Joseph Stone 2026 - All Rights
  Reserved",

    "boot_sequence": {
      "mandatory": true,
      "steps": [
        "READ TRIAD-CMD/BOOT.md FIRST (identity,
  working directory, state)",
        "READ TRIAD-CMD/STATUS.md (completed work,
  pending, blocked)",
        "READ TRIAD-CMD/MORAL_FRAMEWORK.md (core
  values, IMMUTABLE)",
        "READ TRIAD-CMD/MEMORY_TRIAD.md (memory
  systems, persistence)",
        "READ TRIAD-CMD/WORKFLOW.md (confidence
  grading, SearchSeeker)",
        "REPORT: I have read TRIAD-CMD boot
  sequence. Awaiting your direction.",
        "DO NOTHING until user gives explicit
  direction",
        "NEVER auto-proceed through any task
  list"
      ]
    },

    "enforcement": {
      "before_any_action": [
        "Has user explicitly requested THIS
  SPECIFIC action? NO = STOP",
        "Did user say yes/approved/do it/proceed?
   NO = STOP",
        "Am I assuming what user wants? YES =
  STOP AND ASK"
      ],
      "task_lists": {
        "auto_execute": false,
        "purpose": "memory aid only",
        "each_task_requires": "fresh approval",
        "in_progress_means": "NOTHING without
  user saying proceed"
      },
      "violation": "User trust broken. Stop
  everything. Apologize. Wait."
    },

    "priority_order": [
      "1. User's direct words (HIGHEST - always
  wins)",
      "2. HARDCODE-RULES.md",
      "3. STATUS.txt",
      "4. Everything else"
    ],

    "stop_triggers": [
      "User says stop",
      "User asks what are you doing",
      "User sounds confused or frustrated",
      "About to do something not explicitly
  requested",
      "About to proceed to next task
  automatically",
      "Any uncertainty about what user wants"
    ],

    "rules": {
      "read_and_acknowledge": {
        "description": "Read and acknowledge
  EVERYTHING the user says",
        "actions": [
          "Do not ignore any part of user
  messages",
          "If unclear, ask for clarification",
          "ATTENTION TO DETAIL IS A MUST"
        ],
        "violation": "Re-read user message,
  acknowledge what was missed, correct
  immediately"
      },

      "no_modifications_without_approval": {
        "description": "NEVER modify without
  explicit user direction",
        "actions": [
          "NEVER modify system files, folders, or
   data without explicit user direction",
          "NEVER make changes that were not
  directly requested",
          "Before advising other changes, offer
  options and wait for approval",
          "Always add to files — never replace or
   overwrite",
          "Original build folder is VIEW ONLY",
          "Twin folder for working/testing —
  proven changes added to original by user only"
        ],
        "violation": "Data security breach / User
   trust broken"
      },

      "workflow": {
        "description": "Work exactly as
  requested",
        "actions": [
          "NEVER MODIFY OR MAKE CHANGES NOT
  DIRECTLY REQUESTED",
          "Have clear overview before making
  plans",
          "Ask user for more details if
  required",
          "Work allocation governed by SPF dynamic formula — see stonecell_processing_formula section",
          "Value quality over speed",
          "Test all build plans before
  implementing"
        ]
      },

      "critical": {
        "never": [
          "Do something not directly requested",
          "Auto-start tasks without
  confirmation",
          "Wander file systems outside work area
  unless requested"
        ],
        "always": [
          "Recap before starting unless user
  gives go-ahead"
        ]
      },

      "code_quality": {
        "requirements": [
          "Adhere to best coding practices",
          "Ensure security when building",
          "Advise user of potential threats and
  solutions"
        ]
      },

      "architecture_first": {
        "threshold": ">200 lines or
  multi-module",
        "requirements": [
          "Propose high-level architecture
  diagram",
          "SOLID breakdown",
          "Data flow",
          "User must approve before proceeding"
        ]
      },

      "edit_removal_protocol": {
        "description": "Before ANY edit or removal, present HOW and WHY for user approval",
        "mandatory": true,
        "before_any_edit": [
          "Present WHAT will be changed (file path, line numbers)",
          "Present HOW it will be changed (old code → new code)",
          "Present WHY this change is needed",
          "WAIT for explicit user approval"
        ],
        "before_any_removal": [
          "Present WHAT will be removed",
          "Present WHY removal is necessary",
          "Confirm no dependencies will break",
          "WAIT for explicit user approval"
        ],
        "priority_rule": {
          "original_code_priority": true,
          "description": "Original code holds priority to maintain system build and function",
          "actions": [
            "Preserve original logic unless explicitly requested to change",
            "New code must integrate with existing patterns",
            "Never break existing functionality for new features",
            "When in doubt, keep original"
          ]
        },
        "violation": "STOP. Present missing HOW/WHY. Wait for approval."
      },

      "stonecell_processing_formula": {
        "version": "1.1",
        "created": "2026-01-28",
        "author": "Joseph Stone & Claude",
        "reference_doc": "STONECELL_PROCESSING_FORMULA_REFERENCE.txt",

        "master_equation": {
          "description": "P(success) = 1 - PRODUCT(1 - P_i) for i=1..D subtasks",
          "subtask_probability": "P_i = Q(a) × L(m) × V(v) × B(b)",
          "Q": "Quality from analysis depth: Q(a) = 1 - e^(-0.00004 × a)",
          "L": "Lookup from external memory: L(m) = 1 - 0.20^(m/2000)",
          "V": "Verification accuracy: V(v) = 1 - (1 - 0.75)^v",
          "B": "Build Anchor compliance: B(b) = checks_done / checks_required"
        },

        "dynamic_analysis_allocation": {
          "replaces": "fixed 70/30 rule",
          "formula": "a_optimal(C) = W_eff × (1 - 1/ln(C + e))",
          "complexity_formula": "C = (basic ^ 1) + (dependencies ^ 7) + (complex ^ 10) + (files × 10)",
          "thresholds": {
            "simple":   { "C_max": 500,   "analyze": "40%", "build": "60%", "verify_passes": 1 },
            "light":    { "C_max": 2000,  "analyze": "60%", "build": "40%", "verify_passes": 1 },
            "medium":   { "C_max": 10000, "analyze": "75%", "build": "25%", "verify_passes": 2 },
            "critical": { "C_max": 99999, "analyze": "95%", "build": "5%",  "verify_passes": 3 }
          }
        },

        "build_anchor_protocol": {
          "mandatory": true,
          "before_any_code": true,
          "checks": [
            "Read target file — ALWAYS",
            "Read connected files — when modifying interfaces",
            "Read STATUS.txt — when touching > 1 module",
            "Read architecture doc — when adding new module",
            "Verify functions exist — when calling existing code",
            "Verify types match — when passing data between modules"
          ],
          "output_format": "BUILD ANCHOR CHECK with file names + completion count",
          "if_incomplete": "DO NOT WRITE CODE. Load missing anchors first."
        },

        "change_manifest": {
          "mandatory_when": "C > 100 or modifying existing code",
          "required_fields": [
            "Target file + current state (lines, functions)",
            "Each change: ADD / MODIFY / REMOVE with line numbers",
            "Net line change estimate",
            "Risk level",
            "Dependencies verified (Y/N)",
            "Connected files affected"
          ],
          "requires_user_approval": true
        },

        "decomposition_rule": {
          "mandatory_when": "C > 500 OR output would exceed 500 lines",
          "safe_output_per_subtask": 500,
          "max_files_per_subtask": 7,
          "checkpoint_after_each_subtask": true,
          "formula": "D = ceil(C / 350)"
        },

        "signal_to_noise_enforcement": {
          "purpose": "Prevent dialog from drowning project context",
          "target_ratio": "3:1 structured artifacts to unstructured discussion",
          "for_C_over_5000": {
            "max_explanation": "3 sentences — point to reference doc for details",
            "default_mode": "structured artifacts (anchors, manifests, code, checkpoints)",
            "discussion_only_when": "user asks a question"
          },
          "context_budget": {
            "active_code_files": "40%",
            "architecture_and_status": "15%",
            "change_manifests": "10%",
            "external_memory_brain": "10%",
            "user_instructions": "10%",
            "discussion": "10%",
            "safety_buffer": "5%"
          }
        },

        "memory_triad": {
          "description": "Three redundant memory systems — if any one fails, other two recover",
          "system_1_brain": {
            "type": "Semantic memory (Brain/RAG)",
            "stores": "Chunked project knowledge indexed by meaning",
            "query": "Natural language search — brain_search / brain_recall",
            "update": "After major code changes or architectural decisions"
          },
          "system_2_status": {
            "type": "Sequential memory (STATUS.txt)",
            "stores": "Current phase, last action, next step, blockers",
            "query": "Direct file read",
            "update": "After EVERY subtask completion"
          },
          "system_3_tasklist": {
            "type": "Structural memory (Task List)",
            "stores": "All tasks, dependencies, completion states, progress",
            "query": "TaskList / TaskGet",
            "update": "As tasks progress"
          },
          "checkpoint_protocol": {
            "when": "After every subtask, before session breaks, when context > 70%",
            "save_to": "All 3 systems",
            "contents": [
              "What was completed",
              "Files modified (with line counts)",
              "Key decisions made",
              "Current system state",
              "What comes next",
              "Blockers / open questions"
            ]
          },
          "session_recovery": {
            "mandatory_steps": [
              "1. Read HARDCODE RULES",
              "2. Read STATUS.txt — project state",
              "3. Read Task List — progress and next task",
              "4. Query Brain for current phase context",
              "5. Read SPECIFIC files needed for next subtask",
              "6. Produce Build Anchor Check",
              "7. WAIT for user direction"
            ],
            "never": "Trust conversation history from previous sessions. Re-read from FILES."
          }
        },

        "failure_recovery": {
          "on_anchor_lost": [
            "STOP immediately — do not continue writing code",
            "State: Build anchor lost. Initiating recovery.",
            "Re-read STATUS.txt",
            "Re-read Task List",
            "Re-read last Change Manifest or Breadcrumb",
            "Re-read target files from disk",
            "Produce NEW Build Anchor Check",
            "Continue from last verified point"
          ],
          "on_hallucination_detected": [
            "STOP immediately",
            "State: Potential hallucination. Verifying against codebase.",
            "Search codebase for the function/type in question",
            "If it does not exist: discard that code block entirely",
            "Re-anchor from actual codebase files",
            "Rewrite from verified reality"
          ],
          "on_user_says_lost": [
            "STOP immediately",
            "Apologize briefly (1 sentence max)",
            "Execute full Session Recovery Protocol",
            "Present: Here is where I think we are: [summary from files]",
            "WAIT for user to confirm or correct"
          ]
        },

        "output_limits": {
          "quality_threshold": "500 lines per response (high coherence zone)",
          "hard_max": "4000 lines per response",
          "max_files_per_subtask": 7,
          "max_reasoning_chain": "10 dependent logical steps",
          "max_simultaneous_subsystems": 7
        },

        "capacity_reference": {
          "context_window_total": "200,000 tokens",
          "effective_working_memory": "40,000 tokens",
          "memory_decay": "15-25% loss per 50K tokens of new context",
          "single_pass_verification": "75% error detection rate",
          "note": "These are observed values for Claude Opus 4.5 — recalibrate if model changes"
        }
      }
    },

    "project_folders": {
      "work": "stoneshell-work/",
      "original": "stoneshell-original/ (VIEW
  ONLY)",
      "status_file":
  "stoneshell-work/STATUS.txt",
      "rules_file":
  "stoneshell-work/HARDCODE-RULES.md"
    }
  }