# Autonovel Foundation

> Autonovel Phase 1 — build world.md, characters.md, outline.md, canon.md, voice.md from a seed concept. Iterates until foundation_score (from lib/slop_detect.py) meets the adaptive threshold. Reads $AUTONOVEL_WORKSPACE/$NOVEL_SLUG/seed.txt; writes the five foundation files; updates state.json. Hands off to autonovel-drafting when foundation_score plateaus or threshold met.

- **Type:** Skill
- **Install:** `agentstack add skill-duketwocan-autonovel-agent-skills-autonovel-foundation`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [DukeTwoCan](https://agentstack.voostack.com/s/duketwocan)
- **Installs:** 0
- **Category:** [AI & ML](https://agentstack.voostack.com/c/ai-and-ml)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [DukeTwoCan](https://github.com/DukeTwoCan)
- **Source:** https://github.com/DukeTwoCan/autonovel-agent-skills/tree/main/skills/creative/autonovel-foundation

## Install

```sh
agentstack add skill-duketwocan-autonovel-agent-skills-autonovel-foundation
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# Autonovel — Phase 1 (Foundation)

Build the foundation of a novel: world, characters, outline, canon, voice fingerprint.

## When to use this skill

- State.json shows `"phase": "foundation"`
- User says "let's start a new novel" or "build the foundation"
- Foundation files don't exist yet, OR they exist but foundation_score  --count 30`
```

Generate `characters.md` — protagonist, 2-4 supporting cast, 1-2 antagonists, names chosen from the proposed pools. Each character: name, role, contradictions, voice signature, secret, arc. Then gate the major cast before accepting:
```
!`python3 ${HERMES_SKILL_DIR}/lib/namegen.py check    ...`
```
Acceptance requires exit code 0 (no distinctiveness issues). Write to `$AUTONOVEL_WORKSPACE/$NOVEL_SLUG/characters.md`. Budget ~12k tokens.

### Step 3 — Generate outline.md (act-level)

Read `${HERMES_SKILL_DIR}/references/outline-prompt.md`, seed, world,
characters, `genre_context/compiled/outline.md`, and the story contract.
Substitute the compiled packet as `{GENRE_OUTLINE_BLOCK}` plus all shared
Step 0 values. Generate the architecture pass: 4-6 scalable act ranges and a
title/primary-structure movement for every requested chapter. Write the
temporary architecture draft to
`$AUTONOVEL_WORKSPACE/$NOVEL_SLUG/outline.md`. Budget ~10k tokens.

### Step 4 — Expand outline to scene level

Use the same prompt's scene-card pass. Read the architecture draft and expand
every chapter into the exact labeled fields, reveal budget, and 2-5 row scene
table required by the prompt. Replace `outline.md` with the single complete
document; do not append a second set of chapter headings. Budget ~12k tokens.

Gate the complete outline before generating canon or voice:

```powershell
python ${HERMES_SKILL_DIR}/lib/validation.py outline "$AUTONOVEL_WORKSPACE/$NOVEL_SLUG"
```

On a nonzero exit, repair only the reported outline fields or act ranges and
rerun this command. Do not continue to Step 5 until it exits zero.

### Step 5 — Generate canon.md

Read `${HERMES_SKILL_DIR}/references/canon-prompt.md`, all prior foundation
files, and the story contract. Substitute all shared Step 0 values. Canon uses
the story contract as its genre source of truth; do not load generic pack files
into this prompt. Generate canon: rules that MUST stay consistent — magic
system limits, world-rule edge cases, character backstory anchors, timeline
pins. Write to `canon.md`. Budget ~8k tokens.

### Step 6 — Generate voice.md (voice fingerprint)

Read `${HERMES_SKILL_DIR}/references/voice-prompt.md`, seed, characters, and
the story contract. Substitute all shared Step 0 values. Voice uses the story
contract as its genre source of truth; do not load generic pack files into this
prompt. Generate the voice fingerprint: narrative POV, tense, narrator
distance, signature rhythms, dialogue style markers, sample paragraph in the
target voice. Write to `voice.md`. Budget ~6k tokens.

### Step 7 — Evaluate and run the hard boundary

Run:
```
!`python3 ${HERMES_SKILL_DIR}/lib/slop_detect.py "$AUTONOVEL_WORKSPACE/$NOVEL_SLUG/world.md" --genre-context "$AUTONOVEL_WORKSPACE/$NOVEL_SLUG/genre_context/resolved.json"`
!`python3 ${HERMES_SKILL_DIR}/lib/slop_detect.py "$AUTONOVEL_WORKSPACE/$NOVEL_SLUG/characters.md" --genre-context "$AUTONOVEL_WORKSPACE/$NOVEL_SLUG/genre_context/resolved.json"`
!`python3 ${HERMES_SKILL_DIR}/lib/slop_detect.py "$AUTONOVEL_WORKSPACE/$NOVEL_SLUG/outline.md" --genre-context "$AUTONOVEL_WORKSPACE/$NOVEL_SLUG/genre_context/resolved.json"`
```

Average the three scores into `foundation_score`, then hand that score to the
deterministic validator. This command owns score
recording, iteration changes, and the phase transition:

```powershell
python ${HERMES_SKILL_DIR}/lib/validation.py complete-foundation "$AUTONOVEL_WORKSPACE/$NOVEL_SLUG" --score 
```

Read the JSON result. Exit code nonzero means a hard artifact gate failed and
`state.json` remained byte-identical. Exit code zero with `advanced: false`
means the artifacts passed but the score remains below the current threshold.
Exit code zero with `advanced: true` means the validated foundation moved to
drafting atomically.

### Step 8 — Decide: continue, regenerate, or advance

- If the validator returns issues: report their stable codes and paths,
  regenerate only the responsible artifact, and rerun Step 7. Never edit the
  phase by hand.
- If `advanced` is true: commit the validated foundation files and hand off to
  `autonovel-drafting`.
- If `advanced` is false and `iteration = 20`: report to the user and ask
  whether to lower the threshold or accept the current foundation despite its
  low score. The hard gates remain non-waivable.

### Step 9 — Commit

```
!`cd "$AUTONOVEL_WORKSPACE/$NOVEL_SLUG" && git add . && git commit -m "phase 1: foundation iteration $(python -c 'import json; print(json.load(open("state.json"))["iteration"])')"`
```

## Handoff

When phase complete, invoke `autonovel-drafting`.

## Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [DukeTwoCan](https://github.com/DukeTwoCan)
- **Source:** [DukeTwoCan/autonovel-agent-skills](https://github.com/DukeTwoCan/autonovel-agent-skills)
- **License:** MIT

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/skill-duketwocan-autonovel-agent-skills-autonovel-foundation
- Seller: https://agentstack.voostack.com/s/duketwocan
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
