Skip to content
Back to search

novel-control-station

Use when writing, planning, continuing, repairing, revising, or running marathon/"疯狂写作"/auto continuation mode for Chinese long-form fiction with recurring characters, multiple plotlines, persistent world rules, chapter-by-chapter continuity needs, or style-specific constraints.

Safety scan

A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.

Checked today
Badge for your README
findsafeskills safety rating

Markdown

[![findsafeskills safety rating](/api/listings/jingtai123--novel-control-station-skill/badge.svg)](/listings/jingtai123--novel-control-station-skill)

HTML

<a href="/listings/jingtai123--novel-control-station-skill"><img src="/api/listings/jingtai123--novel-control-station-skill/badge.svg" alt="findsafeskills safety rating" /></a>

Install

i

What was scanned

The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.

SKILL.md · Manifest · 608 lines

View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)

  1. ---
  2. name: novel-control-station
  3. description: Use when writing, planning, continuing, repairing, revising, or running marathon/"疯狂写作"/auto continuation mode for Chinese long-form fiction with recurring characters, multiple plotlines, persistent world rules, chapter-by-chapter continuity needs, or style-specific constraints.
  4. ---
  5. # Novel Control Station
  6. ## Overview
  7. Run fiction projects like a controlled long-form system, not a one-shot prompt. Align the novel first, store project truth in standard files, drive each chapter from those files, and update dynamic state after every chapter. When density rises, add a lightweight secondary control view for recall, line heat, and graph-style interference checks without replacing the core files.
  8. ## When to Use
  9. - Starting a new novel project
  10. - Continuing a serialized story
  11. - Repairing setting drift, character distortion, or dropped relationships
  12. - Rebuilding plotlines, foreshadowing, or chapter plans
  13. - Switching between serialized drafting and publication-oriented revision
  14. - Writing fiction that needs controlled style modules such as suspense, humor, romance, literary depth, horror, fantasy, or mystery
  15. Do not use this skill for one-off poems, short jokes, or isolated scenes that do not need persistent continuity.
  16. ## Hard Rules
  17. - Unless the user explicitly requests another language, all planning artifacts, control documents, and fiction output must be written in Chinese. Default to simplified Chinese.
  18. - Do not begin formal novel design until the main plot direction, core character tension, and ending direction are aligned.
  19. - Do not let a full outline stand if benchmark outline checks still show slogan themes, flat characters, weak line interference, or hollow ending direction.
  20. - Do not start chapter drafting before presenting the full outline and full cast dossier.
  21. - Do not draft a chapter before reading the required project files.
  22. - Do not treat a single flat plot as sufficient when the user wants a long-form novel. Default to multiple active lines.
  23. - Do not let trope convenience, fake depth, or decorative structure override human truth, causal pressure, or social texture.
  24. - Do not treat benchmark logic as doctrine. Use it as a calibrated reference system that must adapt to user intent, genre, and target readership.
  25. - Do not copy a sample work's signature setup, role shell, twist engine, scene pattern, or language texture.
  26. - Do not treat marathon mode as permission to skip chapter control, rewrite escalation, dynamic updates, or logging.
  27. - Do not let a secondary graph, recall map, or scratch index override the standard project files. Derived control views are support systems only.
  28. - Do not satisfy forgotten-element checks with token cameos, cosmetic mentions, or checklist references. Re-entry must change pressure, debt, or expectation.
  29. - Do not run de-AI cleanup as blind flattening. Preserve genre register, era texture, narrator stance, and character voice.
  30. - Do not let narration or interiority slide into review copy, theory-heavy explanation, or industry jargon unless the point of view, profession, era, or setting truly requires that diction.
  31. - Do not keep specialist terms, abstract analysis words, or institutional jargon when ordinary readers would lose the thread and the same story work can be done through action, consequence, or scene context.
  32. - Default paragraph mode to `web-serial-natural` unless `09-style-guide.md` or the current chapter control card explicitly switches to `long-paragraph`.
  33. - Do not let chapter prose fake intensity with decorative blank space. Under `web-serial-natural`, narrative paragraphs usually hold `2-4` sentences; single-sentence narrative paragraphs are for emphasis, reveal, shock, cut, or hook and should not chain by habit.
  34. - Do not split one speaker's continuous beat into multiple paragraphs unless interruption, stage movement, or a pressure turn truly changes the beat.
  35. - Do not force scene ladders into rigid formula when the chapter needs looser movement. Use scene control to preserve pressure, not to fake architecture.
  36. - Do not use chapter titles as spoiler summaries, empty riddles, or decorative labels detached from chapter pressure.
  37. - If the project uses chapter titles, lock a naming system at project level and keep title voice consistent unless the book is intentionally entering a new phase.
  38. - If information is missing or contradictory, explain the risk and let the user choose whether to refine details or draft directly.
  39. - If drafting proceeds with assumptions, record them in the dynamic state file.
  40. - After every chapter, update dynamic state before moving on.
  41. - The writing log is audit-only. Never use it as story truth.
  42. ## Standard Files
  43. Maintain these files for every novel project:
  44. - `00-project-overview.md`
  45. - `01-theme-and-proposition.md`
  46. - `02-worldbuilding.md`
  47. - `03-cast-bible.md`
  48. - `04-relationship-map.md`
  49. - `05-main-plotlines.md`
  50. - `06-foreshadow-ledger.md`
  51. - `07-chapter-roadmap.md`
  52. - `08-dynamic-state.md`
  53. - `09-style-guide.md`
  54. - `chapters/`
  55. - `control-cards/`
  56. - `logs/writing-log.md`
  57. Directory rules:
  58. - store accepted chapter manuscripts in `chapters/`
  59. - store one persisted chapter control card per accepted chapter in `control-cards/`
  60. - default file naming:
  61. - `chapters/NN-<chapter-title>.md`
  62. - `control-cards/NN-<chapter-title>-control-card.md`
  63. - if chapters are numbered-only, replace `<chapter-title>` with a short chapter slug rather than leaving filenames blank
  64. Read [document-templates.md](references/document-templates.md) when creating or restoring these files.
  65. ## Startup Project Bootstrap
  66. When starting a new novel project, treat the project root as an operational control surface, not just a folder that stores markdown files.
  67. After creating the standard files, also create:
  68. - `codex-continue-novel.ps1` in the project root
  69. This script is the looping continuation entry point for marathon mode. It should be ready before the project leaves startup.
  70. Use the exact template in [assets/codex-continue-novel.ps1](assets/codex-continue-novel.ps1) and replace only the project root placeholder before writing the file into the project root.
  71. Read [bootstrap-and-marathon-handoff.md](references/bootstrap-and-marathon-handoff.md) when starting a project or handing off into marathon mode.
  72. Bootstrap rules:
  73. - create `codex-continue-novel.ps1` in the project root whenever a new project is initialized
  74. - build the file from `assets/codex-continue-novel.ps1`
  75. - replace only the project root placeholder with the actual project root
  76. - on Windows, write the root script as `UTF-8 with BOM`; `UTF-8 without BOM` can misread Chinese literals under `powershell.exe`
  77. - preserve the template's UTF-8 console setup and explicit UTF-8 log writing when repairing the runner
  78. - repair stale scripts by rebuilding from the template instead of creating a second variant
  79. - verify the root script exists and the placeholder is gone before marathon handoff
  80. - if automatic file creation is blocked, tell the user that startup could not finish automatically and instruct them to create or copy the script manually before marathon handoff
  81. - do not assume the user will remember the launch command later; record the exact command during handoff
  82. ## Secondary Control View
  83. When cast density, plotline interference, or foreshadow volume makes linear rereading too blunt, load [graph-and-recall-control.md](references/graph-and-recall-control.md).
  84. Use it to:
  85. - translate current canon into a temporary node-and-edge control view
  86. - prepare a short retrieval slice for the next chapter instead of rereading blindly
  87. - detect relation jumps, cold lines, unsupported payoffs, and world-rule drift
  88. - route return pressure for characters, plotlines, relationships, and foreshadowing
  89. This layer is derived from the standard files and `08-dynamic-state.md`.
  90. It may be kept as scratch notes or an optional sidecar, but:
  91. - canonical repair always happens in the standard files first
  92. - no new permanent truth source is required
  93. - any conflict between the secondary view and the standard files is resolved in favor of the standard files
  94. ## Foundational Canon Loading
  95. At project launch, major revision, and high-level review, read:
  96. - [foundational-literary-principles.md](references/foundational-literary-principles.md)
  97. - [critical-evaluation-standards.md](references/critical-evaluation-standards.md)
  98. - [epoch-and-people-resonance.md](references/epoch-and-people-resonance.md)
  99. - [reader-retention-and-ai-failure-modes.md](references/reader-retention-and-ai-failure-modes.md)
  100. Use them to convert abstract craft into project truth inside:
  101. - `01-theme-and-proposition.md`
  102. - `02-worldbuilding.md`
  103. - `03-cast-bible.md`
  104. - `05-main-plotlines.md`
  105. - `09-style-guide.md`
  106. Do not leave these readings as commentary. Turn them into enforceable constraints on:
  107. - character desire, fear, shame, debt, and contradiction
  108. - causal line pressure
  109. - point-of-view and form choices
  110. - image and language discipline
  111. - social, institutional, or era pressure
  112. - ending residue and thematic cost
  113. Use [research-source-notes.md](references/research-source-notes.md) only when provenance or source refresh is needed.
  114. ## Benchmark Rule Loading
  115. At project launch, outline design, and chapter review, read:
  116. - [popular-fiction-common-laws.md](references/popular-fiction-common-laws.md)
  117. - [genre-benchmark-rules.md](references/genre-benchmark-rules.md)
  118. - [benchmark-trigger-matrix.md](references/benchmark-trigger-matrix.md)
  119. Use them to determine:
  120. - the active benchmark rule group
  121. - whether the project targets heat, reputation, or dual-high balance
  122. - which pace-intensity checks stay hard and which are dynamically down-weighted
  123. - which originality and compliance alarms must stay active
  124. Use [benchmark-source-trace.md](references/benchmark-source-trace.md) only when source provenance matters.
  125. ## Execution Method Loading
  126. Load these references only when their stage is active:
  127. - [interview-and-handoff-flow.md](references/interview-and-handoff-flow.md)
  128. - [character-construction-methods.md](references/character-construction-methods.md)
  129. - [graph-and-recall-control.md](references/graph-and-recall-control.md)
  130. - [dialogue-writing-rules.md](references/dialogue-writing-rules.md)
  131. - [suspense-and-reveal-design.md](references/suspense-and-reveal-design.md)
  132. - [chapter-architecture-rules.md](references/chapter-architecture-rules.md)
  133. - [chapter-title-method.md](references/chapter-title-method.md)
  134. - [scene-execution-patterns.md](references/scene-execution-patterns.md)
  135. - [forgotten-elements-and-line-heat.md](references/forgotten-elements-and-line-heat.md)
  136. - [authenticity-and-de-ai-pass.md](references/authenticity-and-de-ai-pass.md)
  137. - [continuity-and-marathon-mode.md](references/continuity-and-marathon-mode.md)
  138. Do not read every chapter-stage reference by default. Route only to the references whose pressure is actually active.
  139. Stage routing:
  140. - startup interview and approval handoff:
  141. - `interview-and-handoff-flow.md`
  142. - `character-construction-methods.md`
  143. - outline and roadmap design:
  144. - `graph-and-recall-control.md`
  145. - `chapter-architecture-rules.md`
  146. - `chapter-title-method.md`
  147. - `character-construction-methods.md`
  148. - `scene-execution-patterns.md`
  149. - chapter drafting and revision:
  150. - always load `chapter-architecture-rules.md`
  151. - load `chapter-title-method.md` when the project uses titled chapters or title finalization is active
  152. - load `graph-and-recall-control.md` when recurrence density, cast rotation, or interference pressure is high
  153. - load `dialogue-writing-rules.md` when dialogue is carrying pressure
  154. - load `suspense-and-reveal-design.md` when concealment or reveal fairness is active
  155. - load `scene-execution-patterns.md` when chapter mission is too broad for a single-pass draft
  156. - load `forgotten-elements-and-line-heat.md` when serialized recurrence risk is meaningful
  157. - load `authenticity-and-de-ai-pass.md` after a structurally acceptable draft exists
  158. - load `continuity-and-marathon-mode.md` when continuing long fiction or operating in marathon mode
  159. ## Startup Interview Flow
  160. Run the startup flow using [interview-and-handoff-flow.md](references/interview-and-handoff-flow.md) and [character-construction-methods.md](references/character-construction-methods.md).
  161. Ask one focused question at a time.
  162. Core questions first:
  163. 1. Positioning
  164. - genre, audience, scale, release mode, primary promise, social or era pressure
  165. 2. Characters
  166. - protagonist setup, protagonist core personality, core cast pressure
  167. 3. Scale
  168. - target length, whether the project is multi-line, expected density
  169. 4. Ending Direction
  170. - emotional destination, cost, likely shape of the ending
  171. 5. Style And Market Mode
  172. - primary style, support style, style balance target, support style boundary, target mode, tolerance for slow-burn, default style intensity, paragraph mode, chapter title mode, internalized strengths to absorb, forbidden habits, pseudo-style drift, jargon ceiling, and any professional, historical, or setting terms that must remain legible
  173. Language default:
  174. - keep the project in Chinese unless the user explicitly requests another language
  175. - ask only when needed whether the user wants modern vernacular, historical Chinese texture, web-serial diction, or publication-oriented prose
  176. - unless a publication-oriented or literary long-paragraph preference is explicit, keep the default paragraph mode at `web-serial-natural`
  177. - when diction risk is meaningful, write into `09-style-guide.md`:
  178. - style balance target and the strengths to absorb from mature works
  179. - support style boundary and the chapter-level style intensity range
  180. - paragraph mode, chapter-level override policy, and allowed short-paragraph triggers
  181. - pseudo-style drift to avoid for each active style
  182. - banned AI shell phrases or sentence habits
  183. - jargon ceiling for narration and dialogue
  184. - any necessary professional, historical, or setting terms that must survive authenticity cleanup
  185. Then derive more questions from the answers:
  186. - suspense or mystery:
  187. - hidden truth, clue fairness, reveal ladder
  188. - historical:
  189. - era pressure, institutions, power chain
  190. - long-form or multi-line:
  191. - line count, line interference, stage arcs, convergence and finish logic
  192. - strong protagonist personality:
  193. - stress response, blind spots, speech signature
  194. - romance or high-relationship pressure:
  195. - emotional debt, relational obstacle, intimacy risk
  196. - style-sensitive projects:
  197. - narration distance, prose density, paragraph mode, how often strike paragraphs are allowed, which strengths should stay active across the whole book, how strong the style should usually run, and which pseudo-style drifts must stay off-limits
  198. Do not ask a fixed questionnaire when the project does not need it. Derive only what the current answers make necessary.
  199. Do not move into full design until character pressure, multi-line logic where needed, and ending direction are aligned enough to prevent blind drafting.
  200. ## Outline Benchmark Check
  201. Before a full outline is accepted or a chapter roadmap is locked, read [chapter-architecture-rules.md](references/chapter-architecture-rules.md) and run an outline benchmark check.
  202. Confirm all of these:
  203. - theme is dramatized through choices, not slogans
  204. - protagonist and core cast have desire, obstacle, price, and arc direction
  205. - multiple lines interfere rather than float in parallel
  206. - major characters, plotlines, and foreshadows have visible return logic rather than blind disappearance windows
  207. - the selected genre's benchmark promise is visible
  208. - the ending direction can produce both closure and residue
  209. If the outline benchmark check fails:
  210. - repair the outline first
  211. - update the project files
  212. - do not proceed to chapter drafting
  213. ## Outline And Cast Handoff
  214. After interview alignment and before chapter drafting:
  215. - present the full outline
  216. - present the full cast dossier
  217. The cast dossier must make visible:
  218. - role
  219. - core personality
  220. - visible goal
  221. - inner lack
  222. - key relationships
  223. - contradiction
  224. - arc direction
  225. - speech signature
  226. The outline must make visible:
  227. - the global promise
  228. - main and support lines
  229. - core conflicts
  230. - stage progression
  231. - key turns
  232. - ending direction
  233. Do not start chapters before this handoff is complete.
  234. ## Direct-Edit Branch
  235. After outline and cast handoff, the user may choose direct-edit revision.
  236. If the user gives changes:
  237. - edit the current outline and cast dossier directly
  238. - preserve already aligned material unless the new change conflicts with it
  239. - show the repaired version
  240. Do not restart the whole interview unless the user asks for a real reset.
  241. ## Missing Information Branch
  242. When files or user input leave gaps:
  243. 1. List the missing, conflicting, or risky items.
  244. 2. Explain what each issue threatens.
  245. 3. Offer exactly two branches:
  246. - `refine details`
  247. - `draft directly`
  248. If the user chooses `draft directly`:
  249. - make the smallest safe assumption
  250. - flag it as temporary
  251. - record it in `08-dynamic-state.md` under pending confirmation
  252. ## Paragraph Mode Control
  253. Record paragraph control in `09-style-guide.md` and inherit it into each chapter control card.
  254. Modes:
  255. - `web-serial-natural`
  256. - default mode for chapter prose
  257. - narrative paragraphs usually run `2-4` sentences
  258. - single-sentence narrative paragraphs are reserved for reveal, impact, pressure cut, emotional stall, or hook
  259. - one speaker's dialogue, attached action, and short follow-up should stay in one paragraph unless the beat truly changes
  260. - `long-paragraph`
  261. - use when the project or chapter explicitly needs more continuous interiority, essay-like flow, or publication-oriented long paragraphs
  262. - allow longer narrative blocks, but still break on speaker change, point-of-view shift, scene/time jump, or major pressure turn
  263. - do not turn continuity into inert exposition walls
  264. Override rules:
  265. - the project default comes from `09-style-guide.md`
  266. - the current chapter may override only when the chapter control card records the reason and the intended pace or voice effect
  267. - after drafting and after the authenticity pass, confirm the accepted chapter still matches the selected paragraph mode
  268. ## Chapter Title Control
  269. Read [chapter-title-method.md](references/chapter-title-method.md) when the project uses chapter titles, when the user asks for named chapters, or when a numbered-only chapter system may need to change.
  270. Rules:
  271. - chapter titles are optional; plain numbering is valid when speed, invisibility, or relentless forward pull serves the book better
  272. - if the project uses chapter titles, lock one naming system in `00-project-overview.md`, `07-chapter-roadmap.md`, and `09-style-guide.md`
  273. - each title should carry one primary job and at most one secondary job: hook, focus, orientation, motif return, or voice signal
  274. - generate `3-5` candidate titles from the chapter control card, then choose a working title before drafting
  275. - do not use chapter titles as blunt summaries, spoiler labels, fake-poetic fog, or generic serial filler
  276. - after the chapter passes structure and authenticity checks, run a final title-fit recheck and replace the working title if the chapter's true center moved
  277. ## Chapter Workflow
  278. For every chapter, use this order:
  279. 1. If the project is newly launching, structurally redirecting, or under high-level review, read the foundational canon files first.
  280. 2. Read required files:
  281. - `00-project-overview.md`
  282. - `03-cast-bible.md`
  283. - `05-main-plotlines.md`
  284. - `06-foreshadow-ledger.md`
  285. - `07-chapter-roadmap.md`
  286. - `08-dynamic-state.md`
  287. - `09-style-guide.md`
  288. 3. If the project has dense recurrence, large cast rotation, or multiple active interference lines, prepare a retrieval slice using [graph-and-recall-control.md](references/graph-and-recall-control.md).
  289. - pull only the chapter-relevant characters, relationships, plotlines, foreshadows, world rules, and debts
  290. - track what is hot, what is running cold, and what cannot be forgotten here
  291. 4. Read only the selected internal style module documents needed for this chapter.
  292. - use `09-style-guide.md` to identify style balance target, internalized strengths, support style boundary, preferred intensity range, and pseudo-style drift before loading modules
  293. - read the relevant internal style modules from [style-modules/index.md](references/style-modules/index.md)
  294. - read each selected module's `core.md` first
  295. - drill into deeper style documents only if the chapter needs them
  296. 5. Read only the execution-method references needed for this chapter.
  297. - always read `chapter-architecture-rules.md`
  298. - read `chapter-title-method.md` if the project uses chapter titles or if title finalization is active
  299. - read `graph-and-recall-control.md` if a retrieval slice was needed
  300. - read `dialogue-writing-rules.md` if dialogue pressure is central
  301. - read `suspense-and-reveal-design.md` if suspense or reveal work is active
  302. - read `scene-execution-patterns.md` if the chapter needs multi-unit structural control
  303. - read `forgotten-elements-and-line-heat.md` if recurrence management matters
  304. - read `continuity-and-marathon-mode.md` when continuing or auto-advancing
  305. - read `authenticity-and-de-ai-pass.md` only after a structurally acceptable draft exists
  306. 6. Scan for:
  307. - setting conflicts
  308. - character drift
  309. - broken relationship continuity
  310. - forgotten emotional debt
  311. - overdue recurring characters or relationships
  312. - cold plotlines that need touch, echo, or justified dormancy
  313. - dropped foreshadowing
  314. - unsupported payoff windows
  315. - plotline neglect
  316. - world-rule memory gaps
  317. - trope convenience overriding human truth
  318. - lost social or era pressure
  319. - generic AI shells, false-summary sentences, or over-neat contrast patterns
  320. - analysis-tone drift, platform-copy drift, or unexplained specialist jargon
  321. - paragraph-mode drift such as decorative blank lines, same-speaker over-splitting, or one-sentence paragraph chains with no pressure reason
  322. 7. Generate a chapter control card using [chapter-control-card.md](references/chapter-control-card.md).
  323. - record style intensity, paragraph mode, active style drivers, intended payoff, and pseudo-style drift when style pressure is meaningful
  324. - write the card to `control-cards/NN-<chapter-title>-control-card.md`; if the title is not final yet, use a stable working slug and rename after the final title check
  325. 8. If the project uses chapter titles, generate `3-5` candidate titles using [chapter-title-method.md](references/chapter-title-method.md).
  326. - choose a working title that matches the project's naming system
  327. - record the working title in the chapter control card and `07-chapter-roadmap.md`
  328. 9. If the risk scan is serious, use the missing information branch.
  329. 10. Draft the chapter from the control card.
  330. - when the chapter needs tighter control, write scene by scene or pressure unit by pressure unit using [scene-execution-patterns.md](references/scene-execution-patterns.md)
  331. - inherit paragraph mode from `09-style-guide.md` unless the control card records a chapter-specific override
  332. - under `web-serial-natural`, keep most narrative paragraphs at `2-4` sentences and avoid chaining single-sentence narrative paragraphs unless the scene is deliberately striking beats
  333. - keep one speaker's continuous beat, attached action, and short follow-up in the same paragraph unless the pressure or stage movement changes
  334. - use paragraph breaks for speaker change, scene/time or point-of-view shift, and real pressure turns rather than decorative emptiness
  335. - store the accepted chapter manuscript in `chapters/NN-<chapter-title>.md`
  336. 11. Run the chapter benchmark check.
  337. 12. If the benchmark check fails, apply rewrite escalation before accepting the chapter.
  338. 13. Run the authenticity pass using [authenticity-and-de-ai-pass.md](references/authenticity-and-de-ai-pass.md).
  339. - strip generic AI patterns, false depth, and abstract summaries first
  340. - cut or translate over-professionalized diction unless the project genuinely needs the term
  341. - then restore concrete detail, rhythm variation, and project-specific voice
  342. 14. Run a post-authenticity mini recheck.
  343. - confirm continuity facts still hold
  344. - confirm character voice and relationship pressure did not flatten or drift
  345. - confirm hook, closure, and residue still function
  346. - confirm paragraphing still matches the active paragraph mode and is not leaning on decorative blank space
  347. - confirm readability did not drop behind unnecessary jargon
  348. - confirm required professional, era, or setting terms were not accidentally removed
  349. 15. If the project uses chapter titles, run the final title check.
  350. - confirm the title still matches the accepted chapter's mission, turn, residue, and voice
  351. - replace the working title if the chapter changed its center during drafting
  352. 16. Review the chapter for continuity, style integrity, thematic pressure, critical standards, and whether return-pressure handling stayed causal rather than token.
  353. 17. Update dynamic and structural files.
  354. - keep `chapters/` and `control-cards/` aligned with the accepted chapter title and number
  355. 18. Record the chapter and file updates in the writing log.
  356. ## Chapter Benchmark Check
  357. Read [quality-and-writeback-checks.md](references/quality-and-writeback-checks.md) and [reader-retention-and-ai-failure-modes.md](references/reader-retention-and-ai-failure-modes.md) before accepting a chapter.
  358. Hard gates:
  359. - character, logic, theme, and originality stay hard gates even in slow-burn or restrained modes
  360. - reject flat procedural prose, benchmark cosplay, unsupported payoffs, and dialogue without pressure
  361. - keep protagonist voice, local closure, and carryover debt legible in the accepted chapter
  362. ## Forgotten Element Control
  363. When the project is long, dense, or heavily serialized, run [forgotten-elements-and-line-heat.md](references/forgotten-elements-and-line-heat.md) during planning and review.
  364. Possible outcomes:
  365. - direct advance
  366. - pressure reminder
  367. - justified dormancy note
  368. - closure or archive
  369. Never solve this check with token cameos, random reminders, or fake callbacks that do not alter pressure.
  370. ## Authenticity Pass
  371. After structure and benchmark logic are acceptable, run [authenticity-and-de-ai-pass.md](references/authenticity-and-de-ai-pass.md).
  372. Use a fixed three-part order:
  373. 1. remove generic AI habits, false depth, abstract summaries, empty conclusions, and textureless filler
  374. 2. cut or translate over-specialized diction, analysis-language drift, and reader-hostile jargon unless the point of view or setting genuinely needs the term
  375. 3. restore concrete detail, rhythm variation, speaker distinction, and project-specific voice
  376. Before or during this pass, read `09-style-guide.md` for:
  377. - banned AI shell phrases or phrasing habits
  378. - paragraph mode and allowed short-paragraph triggers
  379. - jargon ceiling for narration and dialogue
  380. - professional, historical, or setting terms that must remain
  381. If the novel intentionally uses literary density, historical register, formal narration, or stylized speech, clean genericity without flattening the chosen mode.
  382. After medium or aggressive authenticity edits, always run a light post-pass recheck on:
  383. - continuity facts
  384. - character voice
  385. - relationship pressure
  386. - hook and closure integrity
  387. - ordinary-reader legibility
  388. - required terminology that should still remain
  389. ## Rewrite Escalation
  390. If the chapter benchmark check fails:
  391. 1. first failure:
  392. - rewrite the full chapter by the issue list
  393. 2. second failure:
  394. - rewrite only the failed dimensions with tighter control
  395. 3. third failure:
  396. - stop blind whole-chapter rewriting
  397. - summarize failing items
  398. - summarize likely root causes
  399. - state whether the fix belongs in outline, character design, pacing, or theme-bearing structure
  400. - revise by cause instead of retrying randomly
  401. ## Marathon Mode
  402. Marathon mode begins only after the user approves the current outline and cast dossier.
  403. If the user asks for crazy writing, nonstop continuation, auto continuation, or marathon-style hands-off drafting:
  404. - load [bootstrap-and-marathon-handoff.md](references/bootstrap-and-marathon-handoff.md)
  405. - ensure `codex-continue-novel.ps1` exists in the project root before handoff
  406. - create or repair the script from `assets/codex-continue-novel.ps1` first if it is missing or stale
  407. - tell the user to close the current session
  408. - then tell the user to run this command from the project root:
  409. ```powershell
  410. powershell -ExecutionPolicy Bypass -File .\codex-continue-novel.ps1
  411. ```
  412. - tell the user that `Ctrl+C` stops the looping runner
  413. - if automatic startup is blocked for any reason, explicitly present the same command as the manual fallback instead of describing the process vaguely
  414. In marathon mode:
  415. - do not ask the user again chapter by chapter
  416. - do keep every internal control step active
  417. For each chapter, still do:
  418. - required file reads
  419. - retrieval slice preparation when density requires it
  420. - chapter control card
  421. - working title generation and final title recheck when titled chapters are active
  422. - selected style module loading
  423. - forgotten-element and line-heat scan
  424. - benchmark and continuity checks
  425. - rewrite escalation when needed
  426. - authenticity pass
  427. - post-authenticity mini recheck
  428. - dynamic-state update
  429. - structural file repair
  430. - writing-log entry
  431. Continue automatically to the next chapter only after the current chapter is accepted and written back into project files.
  432. Stop marathon mode only when the approved outline has naturally concluded:
  433. - main lines are resolved
  434. - support lines are closed or intentionally left with justified residue
  435. - major debts are paid or transformed
  436. - ending direction is fulfilled
  437. Do not stop because a fixed chapter count or word target was reached.
  438. ## Dynamic Update Rules
  439. Read [quality-and-writeback-checks.md](references/quality-and-writeback-checks.md) for the full writeback checklist.
  440. After every accepted chapter:
  441. - update `08-dynamic-state.md` using [dynamic-state-template.md](references/dynamic-state-template.md)
  442. - update changed canonical files in `03/04/05/06/07/02` as needed
  443. - if chapter titles are active, make sure the locked chapter title in `07-chapter-roadmap.md` still matches the accepted chapter
  444. - sync optional secondary control notes only after canonical files are current
  445. - apply the logging rules in [logging-rules.md](references/logging-rules.md)
  446. ## Style Module Loading
  447. The control station contains internal style modules and loads them on demand.
  448. At project start:
  449. - ask for 1 or 2 primary styles
  450. - ask for at most 1 support style
  451. - record style balance target and the strengths to absorb from mature works
  452. - define support style boundary, preferred style intensity range, and pseudo-style drift to avoid
  453. - record forbidden style modes
  454. At chapter time:
  455. - route style loading through [style-modules/index.md](references/style-modules/index.md)
  456. - use `09-style-guide.md` to decide which strengths are active in this chapter and how hard the style should run
  457. - load only the selected internal module `core.md` files first
  458. - load deeper module documents only if the chapter needs them
  459. - write the chosen style pressures, active style drivers, payoff focus, and pseudo-style drift into the chapter control card
  460. Available internal modules:
  461. - humor
  462. - suspense
  463. - mystery
  464. - romance
  465. - horror
  466. - fantasy
  467. - literary
  468. ## Review And Writeback Detail
  469. Read [quality-and-writeback-checks.md](references/quality-and-writeback-checks.md) when applying adaptive weighting, originality discipline, chapter quality gates, final writeback, or common-failure review.
README.md · README · 370 lines

View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)

  1. # Novel Control Station
  2. <div align="center">
  3. <p><strong>把中文长篇小说创作,从一次性生成,升级成可控、可追踪、可持续推进的创作系统。</strong></p>
  4. <p>
  5. <img alt="许可证: MIT" src="https://img.shields.io/badge/license-MIT-111111">
  6. <img alt="聚焦: 中文长篇小说" src="https://img.shields.io/badge/focus-Chinese%20Long--Form%20Fiction-0f766e">
  7. <img alt="架构: 文档驱动" src="https://img.shields.io/badge/architecture-Doc--Driven-1d4ed8">
  8. <img alt="控制: 连续性引擎" src="https://img.shields.io/badge/control-Continuity%20Engine-7c3aed">
  9. </p>
  10. </div>
  11. `novel-control-station` 不是一个“帮你写几段正文”的普通小说技能,而是一套面向中文长篇小说的创作控制中枢。
  12. 它会先对齐题材、受众、主角、规模与结局方向,再生成完整大纲和人物档案;进入正文阶段后,又会按章节读取项目文档、控制结构推进、回写动态状态、修正连续性风险,并在需要时调用内置风格与技法文档,持续压制设定漂移、人物失真、关系断档、伏笔遗忘和文风塌陷。
  13. ## 实战小说
  14. 用这套技能写的小说:[算到皇家秘闻后,公主追着砍我](https://www.qidian.com/book/1048483019/)
  15. 当前正式版本 `0.2.4` 进一步补强了九个升级面:
  16. - 章节标题控制已经并入章节流程,可在项目级锁定命名体系、在单章生成候选标题并在成稿后复核题章贴合度
  17. - 内置风格模块已经整理为选择性加载的内部文档系统,覆盖幽默、悬念、推理、爱情、恐怖、奇幻、文学等风格
  18. - 连续创作模式新增项目根目录启动脚本模板,可为 marathon / 疯狂创作交接准备 `codex-continue-novel.ps1`
  19. - 真实性修订链新增“去分析腔 / 去过度专业术语”控制,默认压低普通读者难以越过、但又不被剧情和视角真正需要的专业词与空泛概念词
  20. - 风格模块现已内化热门连载、长销类型和高口碑小说反复验证过的共通强项,用于增强牵引力、类型兑现和语言辨识度,而不复制具体作品外壳
  21. - 主技能总控、章节验收和发布说明现已与风格强化链同步收敛,避免上层流程落后于参考文档
  22. - 默认段落模式现已切到更符合网文正文的 `web-serial-natural`,并允许项目级或章节级切换到 `long-paragraph`
  23. - 标准项目结构现已把 `chapters/` 和 `control-cards/` 纳入真值层,正文与章节控制卡要求按章落盘
  24. - Windows 下的 marathon runner 现已补上 UTF-8 编码保护、强制写回约束和磁盘写入校验,减少“只输出正文、不写文件”的假成功
  25. 如果你想要的是一个能从开书、控盘、扩写、修补一路推进到自然完结的中文小说生产中枢,这个技能就是为这个目标设计的。
  26. ## Star History
  27. [![Star History Chart](https://api.star-history.com/image?repos=jingtai123/Novel-Control-Station-Skill&type=date&legend=top-left)](https://www.star-history.com/?repos=jingtai123%2FNovel-Control-Station-Skill&type=date&legend=top-left)
  28. ## 它解决什么问题
  29. 长篇小说最难的,通常不是“第一章写不出来”,而是:
  30. - 前期设定很多,中后期自己把自己写忘了
  31. - 人物前十章鲜活,后面开始同质化和工具化
  32. - 主线、支线、感情线、悬疑线各走各的,互不咬合
  33. - 伏笔埋得多,回收要么硬拽,要么直接失踪
  34. - 章节写得越来越像过场,推进了字数,没有推进故事
  35. - 明明是小说正文,结果越写越像评论文、策划案或行业分析
  36. - 去 AI 味时,把节奏、声音、文风和人物辨识度一起洗平
  37. `novel-control-station` 的核心价值,是把这些问题变成前置控制项,而不是写崩之后再返工抢救。
  38. ## 核心能力
  39. ### 1. 开书访谈与方向对齐
  40. 在正式设计前,先锁定题材、受众、主角设定、主角核心性格、创作长度、结局倾向、风格方向等关键条件。
  41. 如果项目属于悬疑、历史、群像、多线叙事等复杂类型,还会继续派生问题,把真正影响长篇走向的变量问清楚。
  42. ### 2. 完整大纲与人物档案先行
  43. 它不会在方向未对齐时直接冲正文。
  44. 默认先给出:
  45. - 完整大纲
  46. - 核心人物档案
  47. - 多线结构关系
  48. - 关键冲突和阶段目标
  49. 用户确认或修改后,再进入正文创作。
  50. ### 3. 多线并行结构控盘
  51. 这个技能把长篇小说默认为多线系统,而不是把一条主线无限拉长。
  52. 在结构层面,它会持续关注:
  53. - 主线推进
  54. - 支线干扰
  55. - 人物关系线变化
  56. - 暗线与伏笔线的回流
  57. - 各线之间的碰撞、借力与收束
  58. 目标不是“线多”,而是“线与线之间会互相制造压力”。
  59. ### 4. 文档驱动,而不是会话硬记
  60. 技能内建一组标准文档,作为小说项目的真值层,包括:
  61. - 项目总览
  62. - 主题命题
  63. - 世界观
  64. - 人物圣经
  65. - 关系图谱
  66. - 主情节线
  67. - 伏笔账本
  68. - 章节路线图
  69. - 动态状态文件
  70. - 风格指南
  71. - `chapters/` 正文章节目录
  72. - `control-cards/` 章节控制卡目录
  73. - 写作日志
  74. 小说的稳定性,不依赖模型“记得住”,而依赖可持续更新的项目文档。
  75. ### 5. 动态状态管理与防漂移
  76. 每完成一章,技能都会要求回写:
  77. - 关键事件
  78. - 人物状态变化
  79. - 关系变化
  80. - 情节线推进
  81. - 伏笔状态
  82. - 世界规则变更
  83. - 情绪债务与未兑现承诺
  84. - 下一章承接压力
  85. 这使它具备很强的抗遗忘、抗跑偏和抗断档能力。
  86. ### 6. 图式回忆与复杂项目召回
  87. 它吸收了图结构管理角色、事件、关系、伏笔、世界规则的思路,但不会制造第二套互相打架的真相源。
  88. 标准项目文件始终是唯一真值层,图式回忆只作为临时控制视图,用于快速提取本章必须回读和处理的内容。
  89. ### 7. 章节控制、章节命名与强钩子闭环
  90. 每一章在动笔前,都会先明确:
  91. - 本章必须改变什么
  92. - 哪条线要推进
  93. - 哪个债务要回归
  94. - 本章冲突是什么
  95. - 结尾留下什么余波或牵引
  96. 如果项目启用了章节名,它还会把章节命名纳入控制流程,先锁定全书命名体系,再为单章生成多个候选名,最后在成稿后复核标题是否仍然贴合本章真正的重心、悬念和余波。
  97. 如果一章只是把人物从 A 地送到 B 地,它会把这类章节视为结构性疲软。
  98. ### 8. 风格调度与按需引用
  99. 技能已经为不同风格和题材预留了独立参考文档,不会把所有技法硬塞进同一层提示。
  100. 在需要时,它会通过 `references/style-modules/index.md` 选择性加载内部风格模块,先读 `core.md`,只有章节真的需要时才继续展开更深文档。当前内置模块包括:
  101. - 幽默
  102. - 悬念
  103. - 推理
  104. - 爱情
  105. - 恐怖
  106. - 奇幻
  107. - 文学
  108. 它支持主风格与辅助风格协同,但不会把所有风格一次性压进同一章。
  109. 它现在不只是在“选风格”,还会把成熟作品反复验证过的优点内化成项目级和章节级控制项:
  110. - 本书想吸收哪些风格强项
  111. - 主风格和辅助风格如何分工
  112. - 本章真正要兑现哪一种风格回报
  113. - 哪些伪风格滑坡必须避免
  114. 这意味着它不是单一文风生成器,而是带有调度能力和风格强化能力的风格中枢。
  115. ### 9. 真实性修订与去 AI 味
  116. 它不会把“去 AI 味”理解成把文字洗成没有个性的白水句。
  117. 它采用的是三步修订:
  118. 1. 去掉抽象套话、虚假深刻、模板化过渡、空泛收束和工整过头的句式
  119. 2. 压低普通读者难以越过的专业术语、分析腔、行业黑话和概念词,但保留剧情、时代、职业或设定真正需要的词
  120. 3. 恢复具体细节、人物声音、中文语感、时代质地和项目自身文风
  121. 目标不是更平,而是更像这本小说自己该有的语言,而且不把读者卡死在作者式概念总结里。
  122. ### 10. 疯狂创作模式、启动脚本与自然完结
  123. 用户确认大纲和人物档案后,可以开启连续创作模式。
  124. 在这个模式里,技能不会在每一章后反复请求人工确认,而是持续执行:
  125. - 读取项目文档
  126. - 生成章节控制卡
  127. - 生成并复核章节标题(如果项目使用章节名)
  128. - 起草正文
  129. - 进行逻辑校验与必要重写
  130. - 更新动态状态
  131. - 写入审计日志
  132. - 自动进入下一章
  133. 直到按完整大纲自然完结为止。
  134. 如果用户要开启疯狂创作 / 自动续写模式,技能还会先准备项目根目录启动脚本:
  135. - 从 `assets/codex-continue-novel.ps1` 生成项目专用 `codex-continue-novel.ps1`
  136. - 替换项目根目录占位符
  137. - 在 Windows 下按 `UTF-8 with BOM` 写出脚本,并初始化 UTF-8 日志
  138. - 强制要求 Codex 直接写回 `chapters/`、`control-cards/` 与项目真值文件,而不是只把正文打印到标准输出
  139. - 如果检测到会话结束但项目文件没有变化,runner 会停止并把这次执行视为未真正写回
  140. - 在交接时明确给出启动命令:
  141. `powershell -ExecutionPolicy Bypass -File .\codex-continue-novel.ps1`
  142. ## 能力看板
  143. | 模块 | 能力表现 |
  144. |---|---|
  145. | 立项层 | 题材定位、受众识别、主角与冲突对齐、规模判断 |
  146. | 设计层 | 完整大纲、人物档案、世界规则、关系结构、多线编排 |
  147. | 创作层 | 章节控制、章节命名、钩子设计、闭环推进、场景落地、节奏调度 |
  148. | 连续性层 | 设定防漂移、人物防失真、关系防断档、伏笔防遗失 |
  149. | 调度层 | 风格模块按需读取、风格强项内化、题材规则按需触发、复杂项目回忆切片 |
  150. | 修订层 | 去 AI 味、去分析腔与过度专业术语、真实性增强、人物声音校准、叙事力度修正 |
  151. | 项目层 | 动态状态管理、标题体系锁定、日志留痕、长期推进、自然完结控制 |
  152. ## 它是怎么工作的
  153. ### 第一步:先把方向问透
  154. 技能会围绕题材、受众、主角、核心性格、篇幅、结局方向等问题展开访谈。
  155. 如果用户只给了粗设定,它会判断是继续补细节,还是在明确风险后直接进入设计。
  156. ### 第二步:先交付完整设计,再进入正文
  157. 对齐后,先生成完整大纲与人物档案。
  158. 用户可以针对人物、剧情走向、多线结构、主题深度提出修改,直到方向一致。
  159. ### 第三步:按文档驱动章节创作
  160. 每一章开始前,先读取项目真值文件;必要时再调用回忆切片、风格文档、控制卡文档。
  161. 如果项目使用章节标题,还会在章节控制卡阶段先生成候选标题并锁定工作标题。
  162. 章节不是“随机生成”,而是“在可控上下文内推进”。
  163. ### 第四步:写完一章,项目状态立刻更新
  164. 章节完成后,技能会更新动态状态与关键记录,必要时回写章节标题、路线图和风格指南,避免前账失踪、人物弧光断裂、情绪债务蒸发、伏笔遗忘。
  165. ### 第五步:跑完整本,而不是只写局部精彩
  166. 它的终极目标不是把单章写漂亮,而是让整部中文长篇小说从立项到完结都维持稳定质量与结构压力。
  167. 如果要切入 marathon handoff,它还会先确认启动脚本已经写入项目根目录,避免“想自动继续,但下次不知道怎么恢复”。
  168. ## 为什么它和常见小说技能不一样
  169. ### 它不是一次性长提示词
  170. 很多小说技能的本质,依然是“把提示词写得更长一点”。
  171. `novel-control-station` 的重点不是提示词长度,而是控制机制、文档系统和动态回写。
  172. ### 它不是若干技能的松散拼装
  173. 风格、结构、连续性、修订、章节控制都被彻底合并为一组内置文档,由总控入口统一调度。
  174. 用户不需要在多个技能之间切来切去争夺上下文。
  175. ### 它不是把章节标题和风格当装饰层
  176. 章节标题、风格模块、章节验收、动态回写都已并入主流程。
  177. 它不会把标题当成事后贴标签,也不会把风格当成统一撒味精。
  178. ### 它不是只会持续推进
  179. 除了持续写下去,它还擅长:
  180. - 开书立项
  181. - 结构控盘
  182. - 角色与关系维稳
  183. - 文风切换与风格调度
  184. - 爆点、钩子和闭环压力设计
  185. - 中后期失控修补
  186. - 长篇中文小说的整项目管理
  187. ### 它不把爆款规律当成死模板
  188. 它会吸收高口碑作品和成熟创作经验中的通用规则,但不会要求所有小说都套进同一套模具。
  189. 爆款逻辑在这里是参考系,不是唯一答案。
  190. ## 适用场景
  191. - 中文网文长篇
  192. - 连载型小说
  193. - 群像、多主线、强伏笔项目
  194. - 悬疑、权谋、历史、言情、奇幻、现实向长篇
  195. - 需要几十章到上百章稳定推进的作品
  196. - 想让 AI 从“会生成正文”升级到“能控盘整本小说”的创作流程
  197. ## 不适合的场景
  198. - 一次性短篇片段
  199. - 单场景练笔
  200. - 诗歌、口号、极短文本
  201. - 完全不需要连续性和项目管理的即兴写作
  202. ## 内置文档结构
  203. ```text
  204. novel-control-station/
  205. ├── SKILL.md
  206. ├── README.md
  207. ├── LICENSE
  208. ├── CHANGELOG.md
  209. ├── RELEASE_NOTES.md
  210. ├── assets/
  211. │ └── codex-continue-novel.ps1
  212. └── references/
  213. ├── bootstrap-and-marathon-handoff.md
  214. ├── document-templates.md
  215. ├── interview-and-handoff-flow.md
  216. ├── chapter-control-card.md
  217. ├── chapter-title-method.md
  218. ├── continuity-and-marathon-mode.md
  219. ├── quality-and-writeback-checks.md
  220. ├── reader-retention-and-ai-failure-modes.md
  221. ├── graph-and-recall-control.md
  222. ├── forgotten-elements-and-line-heat.md
  223. ├── authenticity-and-de-ai-pass.md
  224. ├── style-modules/
  225. ├── ...
  226. ```
  227. ### 关键目录说明
  228. - `SKILL.md`
  229. - 总控入口,定义整体流程、规则和触发机制。
  230. - `references/`
  231. - 内置文档库,按需读取,不一次性全量展开。
  232. - `references/style-modules/`
  233. - 内部风格模块索引与细分文档,按章节选择性加载。
  234. - `assets/`
  235. - 项目启动脚本模板与其他可复用资源。
  236. ## 快速开始
  237. ```text
  238. 使用 novel-control-station 帮我设计并创作一部长篇中文小说
  239. ```
  240. ```text
  241. 使用 novel-control-station。
  242. 我要写一部长篇悬疑,请先问我题材受众、主角设定、核心性格、长度与结局方向,再给我完整大纲和人物档案。
  243. ```
  244. ```text
  245. 使用 novel-control-station。
  246. 这是我的初始设定:……
  247. 你先补齐必要问题,整理成标准文档,再进入连续创作模式,按完整大纲自然完结停。
  248. ```
  249. ```text
  250. 使用 novel-control-station。
  251. 这本书的章节需要标题。请先帮我确定全书章节命名体系,再在每章控制卡里给出 3 到 5 个候选标题,并在正文成稿后复核定稿标题。
  252. ```
  253. ## 推荐使用方式
  254. 1. 先交代题材、受众、主角、篇幅、结局倾向,以及你是否希望章节使用标题。
  255. 2. 先让技能生成完整大纲和人物档案。
  256. 3. 对大纲和人物做一次集中修改。
  257. 4. 如果项目使用章节标题,先锁定标题体系。
  258. 5. 如果要进入连续创作模式,先让技能为项目生成根目录启动脚本。
  259. 6. 确认后再开启连续创作模式。
  260. 这样它的控盘能力、连续性表现和中后期稳定性会明显更强。
  261. ## 开源信息
  262. - 许可证:MIT
  263. - 默认输出语言:中文
  264. - 定位:面向中文长篇小说项目的控制中枢型技能
  265. - 当前正式版本:`0.2.4`
  266. ## 一句话总结
  267. `novel-control-station` 不是在帮 AI 多写几章。
  268. 它是在把 AI 从“会生成故事”升级成“能统筹、能控盘、能维持、能跑完整本中文小说”的创作系统。
assets/codex-continue-novel.ps1 · Bundled script · 183 lines · 1 finding marked
  1. # codex-continue-novel.ps1
  2. # powershell -ExecutionPolicy Bypass -File .\codex-continue-novel.ps1
  3. # Keep this file encoded as UTF-8 with BOM on Windows.
  4. $utf8Bom = [System.Text.UTF8Encoding]::new($true)
  5. $utf8NoBom = [System.Text.UTF8Encoding]::new($false)
  6. $followUp = @"
  7. 使用novel-control-station技能继续小说的疯狂创作。
  8. 必须直接写回项目文件,不要只在标准输出中返回正文。
  9. 硬性要求:
  10. 1. 继续当前章节链,按顺序创作下一章。
  11. 2. 每完成一章,都必须把正文保存到 chapters/ 下对应的下一章文件,并遵守项目当前命名规则。
  12. 3. 每完成一章,都必须同步创建或更新对应的 control-cards/ 章节控制卡。
  13. 4. 每完成一章,都必须同步更新:
  14. - 08-dynamic-state.md
  15. - logs/writing-log.md
  16. - 07-chapter-roadmap.md
  17. - 06-foreshadow-ledger.md
  18. - 05-main-plotlines.md
  19. - 04-relationship-map.md
  20. - 02-worldbuilding.md
  21. - 03-cast-bible.md
  22. 按需更新,没有变化的文件可以不改。
  23. 5. 标准输出只保留简短进度说明,不要直接输出整章正文。
  24. 6. 如果无法写入上述项目文件,请直接回复 FileWriteBlocked。
  25. 7. 如果整本小说已经完成,而不是当前章节完成,请直接回复 AllNovelDone。
  26. "@
  27. $projectRoot = "__PROJECT_ROOT__"
  28. $logFile = Join-Path $projectRoot "codex-continue.log"
  29. $logEncodingChecked = $false
  30. function Initialize-Utf8Runtime {
  31. try {
  32. & "$env:SystemRoot\System32\chcp.com" 65001 > $null
  33. } catch {
  34. }
  35. try {
  36. [Console]::InputEncoding = $utf8NoBom
  37. [Console]::OutputEncoding = $utf8NoBom
  38. $global:OutputEncoding = $utf8NoBom
  39. } catch {
  40. }
  41. }
  42. function Ensure-LogFile {
  43. if ($logEncodingChecked) {
  44. return
  45. }
  46. if (-not (Test-Path -LiteralPath $logFile)) {
  47. [System.IO.File]::WriteAllText($logFile, "", $utf8Bom)
  48. $script:logEncodingChecked = $true
  49. return
  50. }
  51. $bytes = [System.IO.File]::ReadAllBytes($logFile)
  52. $hasUtf8Bom = $bytes.Length -ge 3 -and $bytes[0] -eq 0xEF -and $bytes[1] -eq 0xBB -and $bytes[2] -eq 0xBF
  53. if ($bytes.Length -eq 0) {
  54. [System.IO.File]::WriteAllText($logFile, "", $utf8Bom)
  55. $script:logEncodingChecked = $true
  56. return
  57. }
  58. if (-not $hasUtf8Bom) {
  59. $legacyLog = Join-Path $projectRoot ("codex-continue.legacy-{0}.log" -f (Get-Date -Format "yyyyMMdd-HHmmss"))
  60. Move-Item -LiteralPath $logFile -Destination $legacyLog -Force
  61. [System.IO.File]::WriteAllText($logFile, "", $utf8Bom)
  62. Write-Host "[encoding] Existing log was archived to $legacyLog"
  63. }
  64. $script:logEncodingChecked = $true
  65. }
  66. function Append-LogLine($text) {
  67. Ensure-LogFile
  68. [System.IO.File]::AppendAllText($logFile, "$text$([Environment]::NewLine)", $utf8NoBom)
  69. }
  70. function Log($msg) {
  71. $time = Get-Date -Format "yyyy-MM-dd HH:mm:ss"
  72. $line = "[$time] $msg"
  73. Write-Host $line
  74. Append-LogLine $line
  75. }
  76. function Write-CommandOutput($lines) {
  77. foreach ($line in @($lines)) {
  78. if ($null -eq $line) {
  79. continue
  80. }
  81. $text = [string]$line
  82. Write-Host $text
  83. Append-LogLine $text
  84. }
  85. }
  86. function Test-StopSignal($lines, $signal) {
  87. foreach ($line in @($lines)) {
  88. if ([string]$line -match ('^\s*' + [regex]::Escape($signal) + '\s*$')) {
  89. return $true
  90. }
  91. }
  92. return $false
  93. }
  94. function Get-TrackedProjectSnapshot {
  95. $entries = New-Object System.Collections.Generic.List[string]
  96. $trackedFiles = @(
  97. '08-dynamic-state.md',
  98. 'logs/writing-log.md',
  99. '07-chapter-roadmap.md',
  100. '06-foreshadow-ledger.md',
  101. '05-main-plotlines.md',
  102. '04-relationship-map.md',
  103. '02-worldbuilding.md',
  104. '03-cast-bible.md'
  105. )
  106. foreach ($relativePath in $trackedFiles) {
  107. $fullPath = Join-Path $projectRoot $relativePath
  108. if (-not (Test-Path -LiteralPath $fullPath)) {
  109. continue
  110. }
  111. $item = Get-Item -LiteralPath $fullPath
  112. $entries.Add(('{0}|{1}|{2}' -f $item.FullName, $item.LastWriteTimeUtc.Ticks, $item.Length))
  113. }
  114. foreach ($relativeDir in @('chapters', 'control-cards')) {
  115. $fullDir = Join-Path $projectRoot $relativeDir
  116. if (-not (Test-Path -LiteralPath $fullDir)) {
  117. continue
  118. }
  119. foreach ($item in (Get-ChildItem -LiteralPath $fullDir -File -Filter '*.md' | Sort-Object FullName)) {
  120. $entries.Add(('{0}|{1}|{2}' -f $item.FullName, $item.LastWriteTimeUtc.Ticks, $item.Length))
  121. }
  122. }
  123. return ($entries -join "`n")
  124. }
  125. Initialize-Utf8Runtime
  126. Set-Location -LiteralPath $projectRoot
  127. Log "开始恢复最后一次会话"
  128. while ($true) {
  129. Set-Location -LiteralPath $projectRoot
  130. $beforeSnapshot = Get-TrackedProjectSnapshot
  131. $output = & codex exec resume --last $followUp --skip-git-repo-check --dangerously-bypass-approvals-and-sandbox 2>&1
  132. $code = $LASTEXITCODE
  133. $afterSnapshot = Get-TrackedProjectSnapshot
  134. Write-CommandOutput $output
  135. if (Test-StopSignal $output "AllNovelDone") {
  136. Log "收到 AllNovelDone,整本小说已完成,停止脚本"
  137. break
  138. }
  139. if (Test-StopSignal $output "FileWriteBlocked") {
  140. Log "收到 FileWriteBlocked,当前会话未能写入项目文件,停止脚本"
  141. break
  142. }
  143. if ($code -eq 0) {
  144. if ($beforeSnapshot -eq $afterSnapshot) {
  145. Log "会话正常结束,但未检测到项目文件写入,停止脚本"
  146. break
  147. }
  148. Log "会话正常结束,并检测到项目文件更新"
  149. continue
  150. }
  151. Log "检测到异常退出,退出码: $code,准备自动继续"
  152. Start-Sleep -Seconds 2
  153. }

Ratings and comments

Sign in to rate this skill.

Sign in

Free to use. If it’s helped, pass it on.