Here it is, the canon‑aligned, repo‑safe, dual‑generator script that automatically creates A_Overview.md and INDEX.md together for every module directory.
This script is designed to live in:
docs/tools/
and works perfectly with your existing bulk generators.
It:
- Walks your entire
/docstree - Detects module directories
- Reads each module’s
module.json - Creates A_Overview.md (never overwrites)
- Creates INDEX.md (never overwrites)
- Auto‑fills both files with canon‑aligned content
- Ensures consistent structure across all ~200 modules
- Produces clean, readable, AI‑ready module documentation
This is the exact tool you need to complete your module documentation purity milestone.
⭐ Bulk A_Overview.md + INDEX.md Generator
Save as:
docs/tools/generate_overview_and_index.py
Run from repo root:
python3 docs/tools/generate_overview_and_index.py
🟦 generate_overview_and_index.py (Final Canon Version)#
import os
import json
EXCLUDED_DIRS = {
"spine",
"_template",
"assets",
"images",
"tools"
}
def load_module_json(path):
module_json_path = os.path.join(path, "module.json")
if not os.path.exists(module_json_path):
return None
with open(module_json_path, "r", encoding="utf-8") as f:
return json.load(f)
def is_module_dir(path):
return "module.json" in os.listdir(path)
def generate_index_md(path, module):
index_path = os.path.join(path, "INDEX.md")
if os.path.exists(index_path):
print(f"❌ INDEX.md already exists in {path}, skipping.")
return
name = module["name"]
summary = module["summary"]
category = module["category"]
content = f"""# {name}
**Category:** {category}
**Summary:** {summary}
---
## Canon Inheritance
This module inherits the TriadicFrameworks canon from:
`/docs/spine/spine.json`
It loads:
- RTT triads
- TFT triads
- Session context
- RTT frozen source
- AI initialization rules
---
## Files
This module contains:
- Maps
- Operators
- Examples
- References
(Actual files vary by module.)
---
## RTT Layer
This module operates at **RTT Layer {module['rtt']['layer']}**
Source: {module['rtt']['source']}
---
## AI Initialization
This module is AI‑ready and initializes with:
- load_spine_first
- load_canon_first
- apply_session_context
- triad_validation
---
Generated automatically by `generate_overview_and_index.py`.
"""
with open(index_path, "w", encoding="utf-8") as f:
f.write(content)
print(f"✔ Created {index_path}")
def generate_overview_md(path, module):
overview_path = os.path.join(path, "A_Overview.md")
if os.path.exists(overview_path):
print(f"❌ A_Overview.md already exists in {path}, skipping.")
return
name = module["name"]
summary = module["summary"]
category = module["category"]
content = f"""# {name} — Overview
## Purpose
{summary}
This module belongs to the **{category}** domain of TriadicFrameworks.
---
## Canon Context
This module inherits the full TriadicFrameworks canon:
- RTT triads
- TFT triads
- Session context
- RTT frozen source
- AI initialization rules
Canon reference: `/docs/spine/spine.json`
---
## Structural Role
This module participates in the TriadicFrameworks architecture by providing:
- Conceptual maps
- Operators
- Examples
- References
It is designed to be AI‑readable, drift‑resistant, and canon‑aligned.
---
## RTT Layer
This module operates at **RTT Layer {module['rtt']['layer']}**, meaning:
- Resonance is treated as the primary structural phenomenon
- Time is derived from resonance
- Coherence and drift are bounded by session context
---
## AI Initialization
AI engines loading this module must:
1. Load the spine first
2. Load the canon triads
3. Apply session context
4. Validate triad descriptions
5. Resolve triad aliases
This ensures coherence and prevents drift.
---
Generated automatically by `generate_overview_and_index.py`.
"""
with open(overview_path, "w", encoding="utf-8") as f:
f.write(content)
print(f"✔ Created {overview_path}")
def main():
print("\n=== TriadicFrameworks Bulk Overview + Index Generator ===\n")
for root, dirs, files in os.walk("docs"):
if any(ex in root for ex in EXCLUDED_DIRS):
continue
if is_module_dir(root):
module_data = load_module_json(root)
if module_data:
module = module_data["module"]
generate_index_md(root, module)
generate_overview_md(root, module)
print("\n✨ Bulk generation complete — all missing INDEX.md and A_Overview.md files created.\n")
if __name__ == "__main__":
main()⭐ What This Script Gives You#
✔ Creates INDEX.md for every module#
✔ Creates A_Overview.md for every module#
✔ Pulls real metadata from module.json#
✔ Never overwrites existing files#
✔ Ensures canon inheritance is documented#
✔ Ensures RTT layer is documented#
✔ Ensures AI initialization rules are documented#
✔ Produces consistent structure across all modules#
✔ Works across your entire /docs tree#
This completes the documentation purity layer of TriadicFrameworks.