Analysis Files
How ChapterWise stores analysis results in sibling .analysis.json files
Analysis Files
Analysis results in ChapterWise are stored as sibling files next to your source codex files. This design allows your analysis to travel with your manuscript and be version-controlled alongside your content.
File Naming Convention
| Source File | Analysis File |
|---|---|
manuscript.codex.yaml |
manuscript.analysis.json |
chapters/chapter-1.codex.md |
chapters/chapter-1.analysis.json |
story.codex.json |
story.analysis.json |
The analysis file always shares the same base name as the source file, with .analysis.json replacing the codex extension.
Why JSON?
Analysis files use JSON format (not YAML) for performance reasons:
- 5-30x faster parsing compared to YAML
- Analysis is machine-generated, not human-edited
- Uses the
orjsonlibrary for maximum speed - Still follows the codex structure format
File Structure
Analysis files use the standard codex format with specialized node types:
{
"metadata": {
"formatVersion": "1.2",
"created": "2026-02-02T12:34:56Z",
"updated": "2026-02-02T14:00:00Z"
},
"id": "manuscript-analysis",
"type": "analysis",
"name": "Analysis Results",
"attributes": [
{"key": "sourceFile", "value": "manuscript.codex.yaml"},
{"key": "sourceHash", "value": "abc123def456..."}
],
"children": [
{
"id": "characters",
"type": "analysis-module",
"name": "Characters",
"children": [
{
"id": "entry-20260202T123456Z",
"type": "analysis-entry",
"status": "published",
"attributes": [
{"key": "model", "value": "claude-sonnet-4"},
{"key": "sourceHash", "value": "abc123def456..."},
{"key": "analysisStatus", "value": "current"}
],
"body": "## Character Analysis\n\n### Main Characters\n..."
}
]
}
]
}
Node Types
analysis-module
Represents an analysis module (e.g., characters, themes, summary):
id: Module identifier (e.g., "characters", "themes")type: Always "analysis-module"name: Human-readable namechildren: Array of analysis entries
analysis-entry
Represents a single analysis run:
id: Unique entry ID with timestamptype: Always "analysis-entry"status: "published" for current, "draft" for staleattributes: Metadata including model, sourceHash, analysisStatusbody: The analysis content (markdown)
Analysis History
Each module can contain multiple entries, preserving your analysis history:
- Most recent entry is always first in the
childrenarray - Older entries are marked with
analysisStatus: "stale" - You can view and compare previous analyses
Staleness Detection
ChapterWise tracks whether analysis is current or stale:
- Each entry stores a
sourceHashof the content when analyzed - When source content changes, the hash no longer matches
- Existing analyses are automatically marked as
stale - UI indicates when re-analysis is recommended
Benefits
Version Control Friendly
- Analysis files can be committed to git
- Track analysis changes over time
- Review analysis in pull requests
Portable
- Analysis travels with your manuscript
- Export includes all analysis data
- No database dependency for reading results
Fast
- JSON parsing is extremely fast
- No database queries needed to display results
- Instant loading in the UI