@tophtab/homer 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.homer/adapters/agents/skills/homer/SKILL.md +36 -0
- package/.homer/adapters/agents/skills/homer-setup/SKILL.md +46 -0
- package/.homer/adapters/agents/skills/homer-sync/SKILL.md +62 -0
- package/.homer/adapters/agents/skills/homer-write/SKILL.md +57 -0
- package/.homer/adapters/codex/config.toml +2 -0
- package/.homer/adapters/codex/hooks/inject-homer-state.py +45 -0
- package/.homer/adapters/codex/hooks.json +15 -0
- package/.homer/adapters/codex/skills/homer-start/SKILL.md +26 -0
- package/.homer/knowledge/author-lore/index.json +5 -0
- package/.homer/knowledge/public-lore/index.json +5 -0
- package/.homer/knowledge/tracking/character-state.json +5 -0
- package/.homer/knowledge/tracking/context.json +5 -0
- package/.homer/knowledge/tracking/foreshadowing.json +5 -0
- package/.homer/knowledge/tracking/patches.json +5 -0
- package/.homer/knowledge/tracking/timeline.json +5 -0
- package/.homer/scripts/homer.py +424 -0
- package/.homer/spec/hard-rules.md +14 -0
- package/.homer/spec/setup.md +34 -0
- package/.homer/spec/sync.md +48 -0
- package/.homer/spec/write.md +51 -0
- package/.homer/state/chapters.json +4 -0
- package/.homer/workflow.md +55 -0
- package/LICENSE +21 -0
- package/README.md +311 -0
- package/bin/homer +17 -0
- package/bin/homer.js +35 -0
- package/package.json +21 -0
- package/scripts/homer-install.py +185 -0
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: homer
|
|
3
|
+
description: "Route Homer novel-assistant requests inside a single-book project. Use when Codex needs to initialize a Homer project, write or polish chapters, accept chapters into canon, rebuild public lore/tracking, rebuild author-lore indexes, or decide which Homer workflow applies."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Homer Router
|
|
7
|
+
|
|
8
|
+
Load Homer state before acting:
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
python3 .homer/scripts/homer.py status
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
Read:
|
|
15
|
+
|
|
16
|
+
- `.homer/workflow.md`
|
|
17
|
+
- `.homer/spec/hard-rules.md`
|
|
18
|
+
- `.homer/state/chapters.json`
|
|
19
|
+
|
|
20
|
+
## Route
|
|
21
|
+
|
|
22
|
+
- Setup, init, repair, or import existing chapters: use `homer-setup`.
|
|
23
|
+
- Write, continue, expand, polish, or revise chapters: use `homer-write`.
|
|
24
|
+
- Accept chapters, rebuild public lore/tracking, or rebuild author-lore indexes: use `homer-sync`.
|
|
25
|
+
|
|
26
|
+
If `.homer/` is missing or `.homer/scripts/homer.py` is unavailable and the user wants Homer behavior, route to `homer-setup`.
|
|
27
|
+
|
|
28
|
+
## Boundaries
|
|
29
|
+
|
|
30
|
+
- One project is one book.
|
|
31
|
+
- `设定/`, `大纲/`, and `正文/` are author-owned freeform files.
|
|
32
|
+
- Default writing does not read full `设定/`.
|
|
33
|
+
- `accepted` chapters are canon and are not edited by default.
|
|
34
|
+
- `draft` chapters are editable.
|
|
35
|
+
- Public lore and tracking are generated only from accepted chapters.
|
|
36
|
+
- After writing, do not auto-accept or auto-sync.
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: homer-setup
|
|
3
|
+
description: "Initialize or repair a Homer single-book novel project. Use when setting up .homer infrastructure, scanning existing chapter files, creating or fixing .homer/state/chapters.json, confirming imported chapter statuses, or generating .agents/.codex adapter files from Homer sources."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Homer Setup
|
|
7
|
+
|
|
8
|
+
Initialize or repair the current directory as one Homer book project.
|
|
9
|
+
|
|
10
|
+
## Steps
|
|
11
|
+
|
|
12
|
+
1. Read `HOMER_MVP_SPEC.md` if present.
|
|
13
|
+
2. Read `.homer/spec/setup.md` and `.homer/spec/hard-rules.md` if present.
|
|
14
|
+
3. Ensure `设定/`, `大纲/`, `正文/`, and `.homer/` infrastructure exist.
|
|
15
|
+
4. Run:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
python3 .homer/scripts/homer.py init --scan
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
5. Inspect `.homer/state/chapters.json`.
|
|
22
|
+
6. If existing chapter status is uncertain, ask before changing status.
|
|
23
|
+
7. Generate adapters:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
python3 .homer/scripts/homer.py generate-adapters
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Existing Chapter Status
|
|
30
|
+
|
|
31
|
+
- Empty `正文/`: initialize empty state.
|
|
32
|
+
- One existing chapter: ask whether it is `draft` or `accepted` unless the user made it clear.
|
|
33
|
+
- Multiple existing chapters: confirm all accepted, all draft, first N accepted, or a custom pattern.
|
|
34
|
+
- Imported completed or serialized works may be marked accepted only when the user says they are completed/published.
|
|
35
|
+
|
|
36
|
+
Do not guess batch chapter status.
|
|
37
|
+
|
|
38
|
+
## After Setup
|
|
39
|
+
|
|
40
|
+
Run:
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
python3 .homer/scripts/homer.py status
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
If accepted chapters exist, use `homer-sync` to rebuild public lore and tracking.
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: homer-sync
|
|
3
|
+
description: "Accept Homer chapters into canon and rebuild structured knowledge. Use when the user says to accept/采纳 a chapter, sync after writing, rebuild public lore, rebuild tracking, mark accepted chapters current after knowledge rebuild, or rebuild the author-lore JSON index from freeform 设定/."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Homer Sync
|
|
7
|
+
|
|
8
|
+
Use sync to accept chapters and rebuild structured JSON knowledge.
|
|
9
|
+
|
|
10
|
+
Read before syncing:
|
|
11
|
+
|
|
12
|
+
- `.homer/workflow.md`
|
|
13
|
+
- `.homer/spec/hard-rules.md`
|
|
14
|
+
- `.homer/spec/sync.md`
|
|
15
|
+
- `.homer/state/chapters.json`
|
|
16
|
+
|
|
17
|
+
## Chapter Acceptance
|
|
18
|
+
|
|
19
|
+
When the user asks to accept a chapter:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
python3 .homer/scripts/homer.py accept <chapter>
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Then:
|
|
26
|
+
|
|
27
|
+
1. Read all `accepted` chapters from `.homer/state/chapters.json`, ordered by chapter number.
|
|
28
|
+
2. Rebuild `.homer/knowledge/public-lore/` from accepted chapter text.
|
|
29
|
+
3. Rebuild `.homer/knowledge/tracking/` from accepted chapter text.
|
|
30
|
+
4. Run:
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
python3 .homer/scripts/homer.py mark-current
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Public Lore
|
|
37
|
+
|
|
38
|
+
Public lore stores reader-known knowledge only. Each item must include source chapter and evidence.
|
|
39
|
+
|
|
40
|
+
Separate:
|
|
41
|
+
|
|
42
|
+
- `shown_fact`
|
|
43
|
+
- `reader_inference`
|
|
44
|
+
- `character_claim`
|
|
45
|
+
- `rumor`
|
|
46
|
+
- `misdirection`
|
|
47
|
+
|
|
48
|
+
## Tracking
|
|
49
|
+
|
|
50
|
+
Tracking stores current serial state extracted directly from accepted chapters:
|
|
51
|
+
|
|
52
|
+
- context
|
|
53
|
+
- timeline
|
|
54
|
+
- character state
|
|
55
|
+
- foreshadowing
|
|
56
|
+
- patches for accepted-canon issues that should be repaired later
|
|
57
|
+
|
|
58
|
+
## Author Lore
|
|
59
|
+
|
|
60
|
+
Rebuild `.homer/knowledge/author-lore/` only when requested, during setup, or when a task needs author settings. Extract explicit facts separately from inferences, candidates, conflicts, and obsolete notes.
|
|
61
|
+
|
|
62
|
+
Do not modify `设定/` unless the user explicitly asks.
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: homer-write
|
|
3
|
+
description: "Write, continue, expand, polish, or revise web-novel chapters in a Homer project. Use when the user provides a chapter draft, asks for prose improvement, asks to continue or expand a chapter, gives direction for a new chapter, or wants direct edits under 正文/."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Homer Write
|
|
7
|
+
|
|
8
|
+
Writing and polishing are one business flow. Edit target files directly under `正文/`.
|
|
9
|
+
|
|
10
|
+
## Required Checks
|
|
11
|
+
|
|
12
|
+
Read before editing:
|
|
13
|
+
|
|
14
|
+
- `.homer/workflow.md`
|
|
15
|
+
- `.homer/spec/hard-rules.md`
|
|
16
|
+
- `.homer/spec/write.md`
|
|
17
|
+
- `.homer/state/chapters.json`
|
|
18
|
+
|
|
19
|
+
Identify the target chapter and file.
|
|
20
|
+
|
|
21
|
+
- If target chapter is `accepted`, do not edit unless the user explicitly asks for canon revision.
|
|
22
|
+
- If target chapter is `draft`, edit the file directly.
|
|
23
|
+
- If target chapter is missing, create it under `正文/` and register it as `draft`.
|
|
24
|
+
|
|
25
|
+
## Context Selection
|
|
26
|
+
|
|
27
|
+
Use minimal context:
|
|
28
|
+
|
|
29
|
+
- Current user instruction.
|
|
30
|
+
- Current chapter outline in `大纲/` when relevant.
|
|
31
|
+
- Relevant `.homer/knowledge/public-lore/*.json`.
|
|
32
|
+
- Relevant `.homer/knowledge/tracking/*.json`.
|
|
33
|
+
- Previous or directly related accepted chapter text only when needed.
|
|
34
|
+
- `.homer/spec/` rules.
|
|
35
|
+
|
|
36
|
+
Do not read full `设定/` by default. If hidden author settings are required, read only relevant `.homer/knowledge/author-lore/` slices.
|
|
37
|
+
|
|
38
|
+
## Editing Semantics
|
|
39
|
+
|
|
40
|
+
- Polish, `打磨`, `优化`: refine existing material.
|
|
41
|
+
- `续写`: continue from existing material.
|
|
42
|
+
- `扩写`: add detail and complete underwritten parts.
|
|
43
|
+
- `重写`: replace only when explicitly requested.
|
|
44
|
+
|
|
45
|
+
If unclear, preserve and improve or expand instead of replacing.
|
|
46
|
+
|
|
47
|
+
Do not introduce canon-changing plot, important new characters, new world rules, relationship changes, or major foreshadowing unless authorized.
|
|
48
|
+
|
|
49
|
+
## Finish
|
|
50
|
+
|
|
51
|
+
Run after editing:
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
python3 .homer/scripts/homer.py check
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Do not auto-accept or sync. Tell the user the chapter remains draft and can be accepted with `homer-sync`.
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""Inject a compact Homer state block for Codex turns."""
|
|
3
|
+
|
|
4
|
+
from __future__ import annotations
|
|
5
|
+
|
|
6
|
+
import subprocess
|
|
7
|
+
import sys
|
|
8
|
+
from pathlib import Path
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def find_root(start: Path) -> Path | None:
|
|
12
|
+
current = start.resolve()
|
|
13
|
+
while current != current.parent:
|
|
14
|
+
if (current / ".homer").is_dir():
|
|
15
|
+
return current
|
|
16
|
+
current = current.parent
|
|
17
|
+
return None
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def main() -> int:
|
|
21
|
+
root = find_root(Path.cwd())
|
|
22
|
+
if root is None:
|
|
23
|
+
return 0
|
|
24
|
+
script = root / ".homer" / "scripts" / "homer.py"
|
|
25
|
+
if not script.is_file():
|
|
26
|
+
return 0
|
|
27
|
+
try:
|
|
28
|
+
result = subprocess.run(
|
|
29
|
+
[sys.executable, str(script), "hook-state"],
|
|
30
|
+
cwd=root,
|
|
31
|
+
text=True,
|
|
32
|
+
stdout=subprocess.PIPE,
|
|
33
|
+
stderr=subprocess.DEVNULL,
|
|
34
|
+
timeout=2,
|
|
35
|
+
check=False,
|
|
36
|
+
)
|
|
37
|
+
except Exception:
|
|
38
|
+
return 0
|
|
39
|
+
if result.stdout.strip():
|
|
40
|
+
print(result.stdout.rstrip())
|
|
41
|
+
return 0
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
if __name__ == "__main__":
|
|
45
|
+
raise SystemExit(main())
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: homer-start
|
|
3
|
+
description: "Load Homer project state and workflow context in Codex. Use when starting work in a Homer novel project, when Codex hooks are unavailable, when the session was restarted, or when the assistant needs current Homer routing state before setup/write/sync work."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Homer Start
|
|
7
|
+
|
|
8
|
+
Run:
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
python3 .homer/scripts/homer.py status
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
Then read:
|
|
15
|
+
|
|
16
|
+
- `.homer/workflow.md`
|
|
17
|
+
- `.homer/spec/hard-rules.md`
|
|
18
|
+
- `.homer/state/chapters.json`
|
|
19
|
+
|
|
20
|
+
Route the user's request:
|
|
21
|
+
|
|
22
|
+
- Setup, init, repair, import, adapter regeneration: `homer-setup`.
|
|
23
|
+
- Write, continue, expand, polish, revise: `homer-write`.
|
|
24
|
+
- Accept chapters, rebuild public lore/tracking, rebuild author-lore: `homer-sync`.
|
|
25
|
+
|
|
26
|
+
If `.homer/scripts/homer.py` is missing, initialize or repair with `homer-setup`.
|