From ghostwriter
Apply targeted fixes to specific sentences without regenerating entire text
How this skill is triggered — by the user, by Claude, or both
Slash command
/ghostwriter:surgical-updateThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Apply targeted, sentence-level fixes to text. This skill is loaded when the Optimizer determines that surgical fixes are more efficient than full regeneration.
Apply targeted, sentence-level fixes to text. This skill is loaded when the Optimizer determines that surgical fixes are more efficient than full regeneration.
bun "$GHOSTWRITER_ROOT/agent/tools/writer/extract-sentences.ts" {TEXT_FILE} --out {SESSION_PATH}/sentences.json
This produces a JSON file with every sentence assigned a sequential ID.
bun "$GHOSTWRITER_ROOT/agent/tools/writer/analyze-punctuation.ts" {TEXT_FILE} --target-density 4.0 --out {SESSION_PATH}/punctuation-analysis.json
This identifies:
Using the full text for context and the list of problematic sentence IDs, generate replacement sentences that:
Replacement priority for em-dashes:
Write replacements to a JSON file:
{
"replacements": [
{"id": 3, "original": "The system was compromised — attackers exploited trust.", "text": "The system was compromised; attackers exploited trust."},
{"id": 7, "original": "Security came second to convenience — always.", "text": "Security came second to convenience."}
]
}
Then apply:
bun "$GHOSTWRITER_ROOT/agent/tools/writer/replace-sentences.ts" --source {TEXT_FILE} --replacements {SESSION_PATH}/replacements.json
Run the analyzer again to confirm the issues are resolved:
bun "$GHOSTWRITER_ROOT/agent/tools/writer/analyze-punctuation.ts" {TEXT_FILE}
Check that:
Auxiliary verb density (is, are, was, were, have, has, had, will, would, can, could, may, might, must) above 5.5% is a strong AI detection signal. LLMs cannot self-regulate this during generation, so surgical post-processing is required.
bun "$GHOSTWRITER_ROOT/agent/tools/writer/analyze-auxiliary-verbs.ts" {TEXT_FILE} --target-density 5.0 --out {SESSION_PATH}/auxiliary-analysis.json
This identifies:
For each flagged sentence (focus on critical and high priority first), generate a replacement that:
Transformation strategies by pattern type:
| Pattern | Example Before | Example After | Strategy |
|---|---|---|---|
progressive | "The system is running slowly" | "The system runs slowly" | Simple tense over progressive |
passive | "The breach was caused by attackers" | "Attackers caused the breach" | Active voice |
perfect | "The attack has occurred before" | "The attack occurred before" | Simple past over perfect |
modal | "This would fail under pressure" | "This fails under pressure" | Direct assertion over modal hedging |
modal_perfect | "They could have been compromised" | "They were compromised" | Simplify to past tense |
do_emphasis | "The system does require auth" | "The system requires auth" | Remove do-support |
Additional strategies for high-be documents:
be is the main offender, swap some to non-auxiliary verbs)IMPORTANT: Don't eliminate ALL auxiliary verbs from a sentence. Aim to remove 1-2 per flagged sentence. The goal is reducing document-level density, not zeroing out individual sentences.
Write replacements JSON and apply exactly like punctuation fixes:
bun "$GHOSTWRITER_ROOT/agent/tools/writer/replace-sentences.ts" --source {TEXT_FILE} --replacements {SESSION_PATH}/aux-replacements.json
bun "$GHOSTWRITER_ROOT/agent/tools/writer/analyze-auxiliary-verbs.ts" {TEXT_FILE} --target-density 5.0
Check that:
If density is still over 5.5%, run a second pass targeting the next batch of flagged sentences. Maximum 2 passes.
Pronoun density above 7% is an AI detection signal. The tool groups correlated sentences (pronoun + antecedent) for contextual replacement.
bun "$GHOSTWRITER_ROOT/agent/tools/writer/analyze-pronouns.ts" {TEXT_FILE} --target-density 7.0 --out {SESSION_PATH}/pronoun-analysis.json
For each flagged group (focus on critical and high priority), generate replacements using the suggested strategies:
| Strategy | Example |
|---|---|
| Replace sentence-initial pronoun | "They exploited the flaw" -> "The attackers exploited the flaw" |
| Replace possessive pronouns | "its infrastructure" -> "the network's infrastructure" |
| Break pronoun chains | Restructure to use direct nouns instead of it/they chains |
| Replace demonstrative pronouns | "This caused failures" -> "This design flaw caused failures" |
Same pattern: write JSON, apply via replace-sentences.ts, re-run analyzer. Target: <7% for book chapters, <6% for blogs.
The detector flags four interconnected syntactic monotony signals: missing compound-complex sentences (ratio < 5%), low depth variance (< 1.0), shallow dependency structure (avg depth < 4.0), and high sentence uniformity (> 0.8). These are structural patterns LLMs struggle to self-regulate.
bun "$GHOSTWRITER_ROOT/agent/tools/writer/analyze-sentence-structure.ts" {TEXT_FILE} --out {SESSION_PATH}/structure-analysis.json
This identifies:
signals array)For each flagged sentence (focus on critical and high priority), generate a replacement that increases structural complexity:
Transformation strategies:
| Issue | Transformation | Example |
|---|---|---|
| Simple + merge candidate | Combine into compound-complex | "The protocol assumed trust." + "Attackers exploited that assumption." -> "Although the protocol assumed trust, attackers exploited that assumption and the breach went undetected." |
| Shallow depth | Add subordinate clause | "The system failed." -> "The system, which had been running without oversight for years, failed." |
| Compound -> compound-complex | Add subordination | "The carriers objected and the regulators agreed." -> "The carriers objected because the costs were prohibitive, and the regulators agreed." |
| Very short / uniform | Expand with detail | "It worked." -> "Against all expectations, the crude workaround held together long enough for the team to ship." |
Key principles:
mergeCandidate field — when merging two sentences, include both IDs in replacements (one with merged text, one with empty string)Same pattern: write JSON, apply via replace-sentences.ts, re-run analyzer.
If signals persist after first pass, run a second pass targeting the next batch. Maximum 2 passes.
The detector flags "Reduced noun frequency" when NOUN% < 18% (human baseline ~20%). AI text overuses pronouns, auxiliaries, and abstract verbs at the expense of concrete nouns.
bun "$GHOSTWRITER_ROOT/agent/tools/writer/analyze-noun-density.ts" {TEXT_FILE} --target-density 20.0 --out {SESSION_PATH}/noun-analysis.json
This identifies:
For each flagged sentence (focus on critical and high priority), generate a replacement that increases noun content:
Transformation strategies by issue type:
| Issue Type | Example Before | Example After | Strategy |
|---|---|---|---|
low_noun_high_pronoun | "They implemented it quickly" | "The engineering team implemented the caching layer quickly" | Replace pronouns with specific nouns |
low_noun_high_aux | "It was being considered" | "The committee considered the proposal" | Reduce auxiliaries, add concrete nouns |
vague_references | "This caused things to break" | "This configuration error caused three production servers to break" | Replace vague words with specific nouns |
low_noun_general | "Improvements were made across the board" | "The security team made improvements to authentication, logging, and access controls" | Add actors, objects, concepts |
Key principles:
vagueRefs array — these are the easiest wins (replace "this" with "this [noun]")Same pattern: write JSON, apply via replace-sentences.ts, re-run analyzer. Target: noun density >= 18%, ideally 19-21%.
be has 101 occurrences, focus on be-based patterns firstProvides CDSS development patterns for drug interaction checking, dose validation, clinical scoring (NEWS2, qSOFA), and alert classification integrated into EMR workflows.
npx claudepluginhub svallory/claude-plugins --plugin ghostwriter