Pointf5ive commited on
Commit
f995728
·
verified ·
1 Parent(s): 066e2d1

Upload 2 files

Browse files
Files changed (2) hide show
  1. skills/.DS_Store +0 -0
  2. skills/codex_extractor/SKILL.md +142 -0
skills/.DS_Store ADDED
Binary file (10.2 kB). View file
 
skills/codex_extractor/SKILL.md ADDED
@@ -0,0 +1,142 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # TOTEM Studio Skill — Codex Extractor
2
+
3
+ ## Purpose
4
+ Use this skill whenever editing, reviewing, testing, or prompting work on `src/codex_extractor.py`.
5
+
6
+ The Codex Extractor is a developer-only tool. It extracts raw numerical and categorical author-style fingerprint data from legally accessed PDF/text samples. It does not create final Codex fingerprints by itself.
7
+
8
+ ## Core Terminology
9
+ - **TOTEM** = manuscript auditing layer.
10
+ - **Codex** = author-style comparison and co-creation layer.
11
+ - **Codex Extractor** = developer-only extraction tool that produces raw VM metric data.
12
+ - **Final Codex Fingerprint** = validated/aggregated author model stored in Codex after QA.
13
+
14
+ ## Current Governance State
15
+ - **VM-001 to VM-005 are frozen under Spec v1 calibrated.**
16
+ - **Spec v1 controlled validation is closed and accepted.**
17
+ - Further VM-001 to VM-005 changes require a formal approved **Spec v1.1 issue**.
18
+ - Do not tune VM-004 or any VM-001 to VM-005 rule during normal patching, validation, or sample preparation.
19
+ - Validation failures must be classified first as one of:
20
+ - data/sample issue
21
+ - traceability issue
22
+ - runtime issue
23
+ - potential Spec v1.1 candidate
24
+ - Only a confirmed, approved Spec v1.1 candidate may lead to VM-001 to VM-005 logic changes.
25
+
26
+ ## Non-Negotiable Rules
27
+ 1. Never store copyrighted source text in final Codex fingerprints.
28
+ 2. Store only derived values: numbers, labels, confidence scores, QA flags, provenance metadata, and extractor version.
29
+ 3. Raw extractor output is not automatically a final fingerprint.
30
+ 4. QA/debug artefacts may contain source fragments, but they are developer-only and must not enter final fingerprint storage.
31
+ 5. Preserve existing public function names unless explicitly instructed otherwise:
32
+ - `process_upload()`
33
+ - `extract_fingerprint()`
34
+ - `format_fingerprint_report()`
35
+ - `extract_text_from_file()`
36
+ 6. Do not redesign the extractor when asked for a patch.
37
+ 7. Patch only the requested subsystem.
38
+
39
+ ## Patch Discipline
40
+ When modifying `codex_extractor.py`:
41
+ - Make the smallest possible change.
42
+ - Do not alter unrelated VM metrics.
43
+ - Do not touch OCR, page filtering, metadata provenance, dialogue, repetition, or workbook output unless the user specifically requests it.
44
+ - Do not change VM-006 to VM-013 or VM-024 to VM-028 unless explicitly instructed.
45
+ - Do not change Tier 2 handling.
46
+ - Do not infer bibliography or works sampled. `Works_Sampled` must reflect user input or the actual uploaded filename only.
47
+ - Do not change VM-001 to VM-005 unless the user explicitly approves a formal Spec v1.1 issue.
48
+
49
+ ## VM-001 to VM-005 Standard
50
+ VM-001 to VM-005 must follow **TOTEM Codex Rhyme & Prosody Algorithm Specification v1**.
51
+
52
+ This includes:
53
+ - syllable counting with CMUdict first, fallback heuristic second
54
+ - token-level syllable confidence
55
+ - stress pattern extraction from ARPAbet where available
56
+ - dominant metre/foot support metrics
57
+ - phonetic-first rhyme detection
58
+ - rhyme-tail comparison from the last stressed vowel onward
59
+ - fallback handling for unknown, invented, proper-noun, and OCR-damaged words
60
+ - weighted rhyme density
61
+ - guarded rhyme scheme classification
62
+ - `FREE` must not be returned when meaningful rhyme evidence exists
63
+
64
+ ## Spec v1 Controlled Validation Status
65
+ Spec v1 controlled validation has been accepted and closed.
66
+
67
+ Closure facts:
68
+ - controlled sample pack validation completed
69
+ - final targeted rerun passed
70
+ - no runtime issues remained
71
+ - no traceability gaps remained
72
+ - no extractor logic changes were needed during closure
73
+ - no VM-001 to VM-005 tuning was performed
74
+ - no Spec v1.1 issue was required
75
+
76
+ Governance consequence:
77
+ - Treat VM-001 to VM-005 as stable under Spec v1.
78
+ - Do not reopen VM-001 to VM-005 logic because of a single surprising sample.
79
+ - First review sample quality, expected labels, rights/provenance metadata, and debug artefacts.
80
+ - Only escalate to Spec v1.1 if the failure is reproducible, traceable, not caused by data/sample construction, and approved by the validation lead.
81
+
82
+ ## Manual Page Override Rule
83
+ Manual story-page range must beat automatic filtering.
84
+
85
+ If `start_page` or `end_page` is provided:
86
+ - process only pages inside that inclusive range
87
+ - mark pages outside the range as `out_of_range`
88
+ - do not auto-skip the first page if it is inside the manual range
89
+ - do not apply front-matter exclusion to pages inside the manual range
90
+ - record manual override metadata in `page_trace.csv`, `metric_trace.json`, and the output report
91
+
92
+ If no manual range is provided:
93
+ - use automatic page filtering
94
+ - raise a QA warning if OCR is used without a manual story-page range
95
+
96
+ ## Required Debug Artefacts
97
+ Every extraction run should be able to produce:
98
+ - `cleaned_text.txt`
99
+ - `page_trace.csv`
100
+ - `line_endings.csv`
101
+ - `rhyme_pairs_debug.csv`
102
+ - `syllable_debug.csv`
103
+ - `stress_pattern_debug.csv`
104
+ - `unknown_tokens.csv`
105
+ - `repetition_matches.csv`
106
+ - `prosody_summary.json` where implemented
107
+
108
+ `prosody_summary.json` must not contain source text.
109
+
110
+ ## QA Expectations
111
+ Always test in this order:
112
+ 1. clean text sample
113
+ 2. controlled Gruffalo-style rhymed sample
114
+ 3. scanned/image-only PDF with manual page range
115
+ 4. scanned/image-only PDF with automatic filtering
116
+
117
+ Expected behaviour for clear rhymed picture-book verse:
118
+ - VM-004 must not return `FREE`
119
+ - VM-003 must show meaningful rhyme evidence
120
+ - `rhyme_pairs_debug.csv` must prove the classification
121
+ - OCR uncertainty must reduce confidence, not hide uncertainty
122
+
123
+ ## Controlled Validation Discipline
124
+ For controlled validation or reruns:
125
+ - Do not alter sample text during a run.
126
+ - Do not alter expected labels during a run.
127
+ - Do not tune extractor logic during validation.
128
+ - Preserve per-sample artefacts.
129
+ - Preserve run-level metadata, reviewer notes, pass/fail ledger, and checklist.
130
+ - If a sample fails, classify the failure before proposing any action.
131
+ - Prefer data correction, label correction, retirement, or replacement before any Spec v1.1 escalation.
132
+
133
+ ## Codex Prompting Rule
134
+ When using ChatGPT Codex or another coding agent, tell it:
135
+
136
+ > Before editing, read `skills/codex_extractor/SKILL.md`. Obey it. Patch only the requested subsystem. Do not redesign unrelated code. VM-001 to VM-005 are frozen under Spec v1 unless I approve a formal Spec v1.1 issue.
137
+
138
+ ## Escalation Rule
139
+ If a requested change conflicts with this skill:
140
+ - stop
141
+ - explain the conflict
142
+ - ask for explicit override before proceeding