@compilr-dev/sdk 0.7.8 → 0.7.10

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/dist/agent.js CHANGED
@@ -256,6 +256,7 @@ class CompilrAgentImpl {
256
256
  enabled: guardrailsConfig.enabled,
257
257
  includeDefaults: guardrailsConfig.includeDefaults,
258
258
  },
259
+ delegation: config?.delegation,
259
260
  onEvent: (event) => {
260
261
  // Track usage from events
261
262
  if (event.type === 'usage_recorded') {
package/dist/config.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * SDK configuration types
3
3
  */
4
- import type { LLMProvider, Message, Tool, ToolPermission, HooksConfig, AnchorInput, AgentEvent, ToolExecutionResult } from '@compilr-dev/agents';
4
+ import type { LLMProvider, Message, Tool, ToolPermission, HooksConfig, AnchorInput, AgentEvent, ToolExecutionResult, DelegationConfig } from '@compilr-dev/agents';
5
5
  import type { Preset } from './presets/types.js';
6
6
  import type { ToolProfile } from './team/tool-config.js';
7
7
  import type { ConditionalModule } from './capabilities/hook.js';
@@ -192,6 +192,8 @@ export interface CompilrAgentConfig {
192
192
  hooks?: HooksConfig;
193
193
  /** Context management configuration */
194
194
  context?: ContextConfig;
195
+ /** Tool result delegation — auto-summarize large results to conserve context */
196
+ delegation?: DelegationConfig;
195
197
  /**
196
198
  * Callback for the suggest tool. When provided, the default no-op suggest
197
199
  * tool is replaced with one that calls this callback.
package/dist/index.d.ts CHANGED
@@ -61,7 +61,7 @@ export type { AskUserQuestion, AskUserInput, AskUserResult, AskUserHandler, AskU
61
61
  export { createPlatformTools, createProjectTools, createWorkItemTools, createDocumentTools, createPlanTools, createBacklogTools, createAnchorTools, createArtifactTools, createEpisodeTools, ProjectAnchorStore, } from './platform/index.js';
62
62
  export type { ProjectAnchorStoreConfig } from './platform/index.js';
63
63
  export { STEP_ORDER, GUIDED_STEP_CRITERIA, getNextStep, isValidTransition, getStepCriteria, formatStepDisplay, getStepNumber, } from './platform/index.js';
64
- export { platformSkills, designSkill, sketchSkill, prdSkill, refineSkill, refineItemSkill, architectureSkill, sessionNotesSkill, buildSkill, scaffoldSkill, outlineSkill, literatureReviewSkill, draftSectionSkill, peerReviewSkill, researchScaffoldSkill, businessVisionSkill, marketAnalysisSkill, competitorAnalysisSkill, financialModelSkill, pitchOutlineSkill, businessReviewSkill, brandSetupSkill, contentStrategySkill, contentCalendarSkill, createContentSkill, contentReviewSkill, curriculumDesignSkill, lessonPlanSkill, assessmentDesignSkill, courseReviewSkill, } from './skills/index.js';
64
+ export { platformSkills, designSkill, sketchSkill, prdSkill, refineSkill, refineItemSkill, architectureSkill, sessionNotesSkill, buildSkill, scaffoldSkill, outlineSkill, literatureReviewSkill, draftSectionSkill, peerReviewSkill, researchScaffoldSkill, businessVisionSkill, marketAnalysisSkill, competitorAnalysisSkill, financialModelSkill, pitchOutlineSkill, businessReviewSkill, brandSetupSkill, contentStrategySkill, contentCalendarSkill, createContentSkill, contentReviewSkill, curriculumDesignSkill, lessonPlanSkill, assessmentDesignSkill, courseReviewSkill, bookOutlineSkill, characterDesignSkill, plotThreadsSkill, sceneBreakdownSkill, bookReviewSkill, } from './skills/index.js';
65
65
  export { ACTION_REGISTRY, getActionsForContext, getActionById, resolveActionPrompt, buildContextSummary, getSuggestedRole, } from './actions/index.js';
66
66
  export type { ActionContext, ActionDefinition } from './actions/index.js';
67
67
  export { PROJECT_TYPES, getProjectTypeConfig, getEnrichedProjectTypeConfig, getProjectTypesByCategory, generalConfig, softwareConfig, researchConfig, businessPlanConfig, contentConfig, techDocsConfig, courseConfig, ACTION_META_REGISTRY, SKILL_META_REGISTRY, resolveActionMeta, getSkillMeta, getAllSkillMeta, } from './project-types/index.js';
package/dist/index.js CHANGED
@@ -139,7 +139,7 @@ export { STEP_ORDER, GUIDED_STEP_CRITERIA, getNextStep, isValidTransition, getSt
139
139
  // =============================================================================
140
140
  // Platform Skills (platform-specific prompt expansions)
141
141
  // =============================================================================
142
- export { platformSkills, designSkill, sketchSkill, prdSkill, refineSkill, refineItemSkill, architectureSkill, sessionNotesSkill, buildSkill, scaffoldSkill, outlineSkill, literatureReviewSkill, draftSectionSkill, peerReviewSkill, researchScaffoldSkill, businessVisionSkill, marketAnalysisSkill, competitorAnalysisSkill, financialModelSkill, pitchOutlineSkill, businessReviewSkill, brandSetupSkill, contentStrategySkill, contentCalendarSkill, createContentSkill, contentReviewSkill, curriculumDesignSkill, lessonPlanSkill, assessmentDesignSkill, courseReviewSkill, } from './skills/index.js';
142
+ export { platformSkills, designSkill, sketchSkill, prdSkill, refineSkill, refineItemSkill, architectureSkill, sessionNotesSkill, buildSkill, scaffoldSkill, outlineSkill, literatureReviewSkill, draftSectionSkill, peerReviewSkill, researchScaffoldSkill, businessVisionSkill, marketAnalysisSkill, competitorAnalysisSkill, financialModelSkill, pitchOutlineSkill, businessReviewSkill, brandSetupSkill, contentStrategySkill, contentCalendarSkill, createContentSkill, contentReviewSkill, curriculumDesignSkill, lessonPlanSkill, assessmentDesignSkill, courseReviewSkill, bookOutlineSkill, characterDesignSkill, plotThreadsSkill, sceneBreakdownSkill, bookReviewSkill, } from './skills/index.js';
143
143
  // =============================================================================
144
144
  // Contextual Actions (skill invocations with context)
145
145
  // =============================================================================
@@ -37,7 +37,7 @@ export const MODEL_REGISTRY = [
37
37
  defaultTier: 'balanced',
38
38
  thinkingFormat: 'claude',
39
39
  status: 'supported',
40
- contextWindow: 200000,
40
+ contextWindow: 1000000,
41
41
  },
42
42
  {
43
43
  id: 'claude-opus-4-6',
@@ -47,7 +47,7 @@ export const MODEL_REGISTRY = [
47
47
  defaultTier: 'powerful',
48
48
  thinkingFormat: 'claude',
49
49
  status: 'supported',
50
- contextWindow: 200000,
50
+ contextWindow: 1000000,
51
51
  },
52
52
  // Legacy Claude models (still supported)
53
53
  {
@@ -121,6 +121,7 @@ export class SQLiteDocumentRepository {
121
121
  'business-model': 0,
122
122
  'brand-model': 0,
123
123
  'curriculum-model': 0,
124
+ 'book-model': 0,
124
125
  };
125
126
  for (const row of results) {
126
127
  counts[row.doc_type] = row.count;
@@ -19,6 +19,7 @@ const DOC_TYPE_ENUM = [
19
19
  'business-model',
20
20
  'brand-model',
21
21
  'curriculum-model',
22
+ 'book-model',
22
23
  ];
23
24
  // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
24
25
  export function createDocumentTools(config) {
@@ -10,7 +10,7 @@
10
10
  * - Data models: camelCase properties (output types)
11
11
  * - Input types: snake_case properties (matching CLI tool input schemas)
12
12
  */
13
- export type ProjectType = 'general' | 'web' | 'cli' | 'library' | 'api' | 'research' | 'business-plan' | 'content' | 'tech-docs' | 'course';
13
+ export type ProjectType = 'general' | 'web' | 'cli' | 'library' | 'api' | 'research' | 'business-plan' | 'content' | 'tech-docs' | 'course' | 'book';
14
14
  export type ProjectStatus = 'active' | 'paused' | 'completed' | 'archived';
15
15
  export type RepoPattern = 'single' | 'two-repo';
16
16
  export type WorkflowMode = 'flexible' | 'guided';
@@ -19,7 +19,7 @@ export type WorkItemType = 'feature' | 'bug' | 'tech-debt' | 'chore';
19
19
  export type WorkItemStatus = 'backlog' | 'in_progress' | 'completed' | 'skipped';
20
20
  export type WorkItemPriority = 'critical' | 'high' | 'medium' | 'low';
21
21
  export type GuidedStep = 'plan' | 'implement' | 'test' | 'commit' | 'review';
22
- export type DocumentType = 'prd' | 'architecture' | 'design' | 'notes' | 'plan' | 'app-model' | 'research-model' | 'business-model' | 'brand-model' | 'curriculum-model';
22
+ export type DocumentType = 'prd' | 'architecture' | 'design' | 'notes' | 'plan' | 'app-model' | 'research-model' | 'business-model' | 'brand-model' | 'curriculum-model' | 'book-model';
23
23
  export type PlanStatus = 'draft' | 'approved' | 'in_progress' | 'completed' | 'abandoned';
24
24
  export interface Project {
25
25
  id: number;
@@ -64,6 +64,12 @@ export const ACTION_META_REGISTRY = {
64
64
  'content-calendar': { id: 'content-calendar', label: 'Calendar', icon: 'Calendar', description: 'Plan content' },
65
65
  'create-content': { id: 'create-content', label: 'Create', icon: 'PenTool', description: 'Write content' },
66
66
  'content-review': { id: 'content-review', label: 'Review', icon: 'CheckCircle', description: 'Check quality' },
67
+ // ── Book actions ─────────────────────────────────────────────────────────
68
+ 'book-outline': { id: 'book-outline', label: 'Outline', icon: 'BookOpen', description: 'Plan structure' },
69
+ 'character-design': { id: 'character-design', label: 'Characters', icon: 'Users', description: 'Build cast' },
70
+ 'plot-threads': { id: 'plot-threads', label: 'Threads', icon: 'GitBranch', description: 'Map plot lines' },
71
+ 'scene-breakdown': { id: 'scene-breakdown', label: 'Scenes', icon: 'Layers', description: 'Detail scenes' },
72
+ 'book-review': { id: 'book-review', label: 'Review', icon: 'CheckCircle', description: 'Structure check' },
67
73
  // ── Course / Training actions ─────────────────────────────────────────────
68
74
  'curriculum-design': { id: 'curriculum-design', label: 'Curriculum', icon: 'School', description: 'Define structure' },
69
75
  'lesson-plan': { id: 'lesson-plan', label: 'Lessons', icon: 'BookOpen', description: 'Plan lessons' },
@@ -9,3 +9,4 @@ export declare const businessPlanConfig: ProjectTypeConfig;
9
9
  export declare const contentConfig: ProjectTypeConfig;
10
10
  export declare const techDocsConfig: ProjectTypeConfig;
11
11
  export declare const courseConfig: ProjectTypeConfig;
12
+ export declare const bookConfig: ProjectTypeConfig;
@@ -658,3 +658,88 @@ This project uses a Curriculum Model that tracks the course structure: modules (
658
658
  - **Content Designer** — lesson planning, exercises, assessments
659
659
  - **Reviewer** — pedagogical quality, balance, difficulty calibration`,
660
660
  };
661
+ // =============================================================================
662
+ // Book
663
+ // =============================================================================
664
+ export const bookConfig = {
665
+ id: 'book',
666
+ label: 'Book',
667
+ description: 'Plan and write fiction or non-fiction books',
668
+ icon: 'BookOpen',
669
+ category: 'writing',
670
+ phases: [
671
+ {
672
+ id: 'outline',
673
+ label: 'Outline',
674
+ description: 'Define structure, beats, and chapters',
675
+ completionCheck: 'has-document',
676
+ completionDocType: 'book-model',
677
+ },
678
+ {
679
+ id: 'characters',
680
+ label: 'Characters',
681
+ description: 'Build character profiles and relationships',
682
+ completionCheck: 'has-workitems',
683
+ },
684
+ {
685
+ id: 'scenes',
686
+ label: 'Scenes',
687
+ description: 'Break chapters into scenes',
688
+ completionCheck: 'has-workitems',
689
+ },
690
+ { id: 'draft', label: 'Draft', description: 'Write chapter drafts', completionCheck: 'has-workitems' },
691
+ { id: 'review', label: 'Review', description: 'Structural review', completionCheck: 'manual' },
692
+ ],
693
+ suggestedAgents: [
694
+ { role: 'plotter', label: 'Plotter', description: 'Story architecture, beats, pacing, plot threads' },
695
+ { role: 'character-dev', label: 'Character Dev', description: 'Characters, arcs, relationships, voice' },
696
+ { role: 'scene-writer', label: 'Scene Writer', description: 'Scene construction, setting, POV, transitions' },
697
+ ],
698
+ documentTemplates: [
699
+ { type: 'book-model', label: 'Book Model', description: 'Story structure, characters, plot threads, beats' },
700
+ { type: 'notes', label: 'Chapter Draft', description: 'Chapter content' },
701
+ { type: 'session-notes', label: 'Session Notes', description: 'Summary of work done' },
702
+ ],
703
+ projectActions: ['book-outline', 'character-design', 'plot-threads', 'scene-breakdown', 'book-review', 'session-notes'],
704
+ workItemActions: ['refine-item', 'explain'],
705
+ workItemLabels: {
706
+ feature: { short: 'CH', full: 'Chapter' },
707
+ bug: { short: 'RV', full: 'Revision' },
708
+ 'tech-debt': { short: 'RS', full: 'Research' },
709
+ chore: { short: 'TK', full: 'Task' },
710
+ },
711
+ systemPromptContext: 'This is a book project. The user is writing a fiction or non-fiction book. Focus on narrative structure, character development, and story pacing.',
712
+ systemPromptSection: `## Project Context: Book
713
+
714
+ You are assisting with a book project. Your role is to help the user plan and structure their book — fiction or non-fiction. You are a **story architect**, helping with structure, not writing prose for the user.
715
+
716
+ ### Book Model
717
+ This project uses a Book Model that tracks: chapters (with scenes), characters (with relationships and arcs), plot threads, themes, settings, and a beat sheet (story structure). Always read the model before making suggestions.
718
+
719
+ ### Workflow
720
+ 1. **Outline** — Define the book's structure using a story template (Hero's Journey, Three-Act, etc.)
721
+ 2. **Characters** — Build character profiles, arcs, and relationship maps
722
+ 3. **Plot Threads** — Define main plot and subplots, map to chapters
723
+ 4. **Scenes** — Break chapters into detailed scenes with characters, settings, and threads
724
+ 5. **Draft** — User writes chapter content (you help structure, not generate prose)
725
+ 6. **Review** — Check structural integrity: beat coverage, character arc completion, plot thread balance
726
+
727
+ ### Work Items
728
+ - **Chapter** (type: feature) — a chapter to write
729
+ - **Revision** (type: bug) — structural issues to fix
730
+ - **Research** (type: tech-debt) — worldbuilding, reference material
731
+ - **Task** (type: chore) — formatting, notes, organization
732
+
733
+ ### Storytelling Principles
734
+ - Every scene should advance at least one plot thread
735
+ - Characters need arcs — they should change by the end
736
+ - Balance showing vs telling
737
+ - Maintain consistent POV within scenes
738
+ - Pacing: alternate tension and relief
739
+ - Subplots should connect to the main theme
740
+
741
+ ### Team Agents
742
+ - **Plotter** — story architecture, beats, pacing, plot threads
743
+ - **Character Dev** — characters, arcs, relationships, dialogue voice
744
+ - **Scene Writer** — scene construction, setting, POV, transitions`,
745
+ };
@@ -6,7 +6,7 @@
6
6
  * for all types.
7
7
  */
8
8
  export type { ProjectTypeConfig, ProjectPhase, SuggestedAgent, DocumentTemplate, ActionMeta, SkillMeta, } from './types.js';
9
- export { generalConfig, softwareConfig, researchConfig, businessPlanConfig, contentConfig, techDocsConfig, courseConfig, } from './configs.js';
9
+ export { generalConfig, softwareConfig, researchConfig, businessPlanConfig, contentConfig, techDocsConfig, courseConfig, bookConfig, } from './configs.js';
10
10
  export { SKILL_META_REGISTRY, getSkillMeta, getAllSkillMeta } from './skill-meta.js';
11
11
  export { ACTION_META_REGISTRY, resolveActionMeta } from './action-meta.js';
12
12
  import type { ProjectTypeConfig } from './types.js';
@@ -6,12 +6,12 @@
6
6
  * for all types.
7
7
  */
8
8
  // Configs
9
- export { generalConfig, softwareConfig, researchConfig, businessPlanConfig, contentConfig, techDocsConfig, courseConfig, } from './configs.js';
9
+ export { generalConfig, softwareConfig, researchConfig, businessPlanConfig, contentConfig, techDocsConfig, courseConfig, bookConfig, } from './configs.js';
10
10
  // Action & Skill metadata
11
11
  export { SKILL_META_REGISTRY, getSkillMeta, getAllSkillMeta } from './skill-meta.js';
12
12
  export { ACTION_META_REGISTRY, resolveActionMeta } from './action-meta.js';
13
13
  import { resolveActionMeta } from './action-meta.js';
14
- import { generalConfig, softwareConfig, researchConfig, businessPlanConfig, contentConfig, techDocsConfig, courseConfig, } from './configs.js';
14
+ import { generalConfig, softwareConfig, researchConfig, businessPlanConfig, contentConfig, techDocsConfig, courseConfig, bookConfig, } from './configs.js';
15
15
  /** All registered project types */
16
16
  export const PROJECT_TYPES = [
17
17
  softwareConfig,
@@ -21,6 +21,7 @@ export const PROJECT_TYPES = [
21
21
  contentConfig,
22
22
  techDocsConfig,
23
23
  courseConfig,
24
+ bookConfig,
24
25
  ];
25
26
  /** Type aliases — legacy or alternative IDs that map to a canonical config */
26
27
  const TYPE_ALIASES = {
@@ -124,6 +124,12 @@ export const SKILL_META_REGISTRY = {
124
124
  'lesson-plan': { id: 'lesson-plan', label: 'Lesson Plan', description: 'Break modules into lessons', icon: 'BookOpen', category: 'planning' },
125
125
  'assessment-design': { id: 'assessment-design', label: 'Assessment', description: 'Create quizzes and exercises', icon: 'ClipboardCheck', category: 'planning' },
126
126
  'course-review': { id: 'course-review', label: 'Course Review', description: 'Pedagogical quality check', icon: 'CheckCircle', category: 'analysis' },
127
+ // ── Book Skills ──────────────────────────────────────────────────────────
128
+ 'book-outline': { id: 'book-outline', label: 'Book Outline', description: 'Define structure, beats, and chapters', icon: 'BookOpen', category: 'planning' },
129
+ 'character-design': { id: 'character-design', label: 'Characters', description: 'Build character profiles and relationships', icon: 'Users', category: 'planning' },
130
+ 'plot-threads': { id: 'plot-threads', label: 'Plot Threads', description: 'Define and track narrative threads', icon: 'GitBranch', category: 'planning' },
131
+ 'scene-breakdown': { id: 'scene-breakdown', label: 'Scenes', description: 'Break chapters into scenes', icon: 'Layers', category: 'development' },
132
+ 'book-review': { id: 'book-review', label: 'Book Review', description: 'Structural review of the book', icon: 'CheckCircle', category: 'analysis' },
127
133
  // ── Builtin Skills (agents library) ──────────────────────────────────────
128
134
  'code-review': {
129
135
  id: 'code-review',
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Book Skills
3
+ *
4
+ * book-outline, character-design, plot-threads, scene-breakdown, book-review
5
+ */
6
+ export declare const bookOutlineSkill: import("@compilr-dev/agents").Skill;
7
+ export declare const characterDesignSkill: import("@compilr-dev/agents").Skill;
8
+ export declare const plotThreadsSkill: import("@compilr-dev/agents").Skill;
9
+ export declare const sceneBreakdownSkill: import("@compilr-dev/agents").Skill;
10
+ export declare const bookReviewSkill: import("@compilr-dev/agents").Skill;
@@ -0,0 +1,195 @@
1
+ /**
2
+ * Book Skills
3
+ *
4
+ * book-outline, character-design, plot-threads, scene-breakdown, book-review
5
+ */
6
+ import { defineSkill } from '@compilr-dev/agents';
7
+ export const bookOutlineSkill = defineSkill({
8
+ name: 'book-outline',
9
+ description: 'Define book structure — beats, chapters, and story template',
10
+ prompt: `You are in BOOK OUTLINE MODE. Help the user structure their book.
11
+
12
+ ## Step 1: Book Overview
13
+ 1. Use \`book_model_get\` scope: "overview" to check existing state
14
+ 2. Ask: title, genre, mode (fiction/non-fiction), logline (one sentence), target word count
15
+ 3. Save: \`book_model_update\` op: "set_book_info"
16
+
17
+ ## Step 2: Choose Story Structure
18
+ Ask which template to use (or custom):
19
+ - **Three-Act Structure** — Setup, Confrontation, Resolution
20
+ - **Hero's Journey** — 12 stages from Ordinary World to Return
21
+ - **Save the Cat** — 15 beats (Opening Image to Final Image)
22
+ - **Seven-Point** — Hook, Plot Turns, Pinch Points, Midpoint, Resolution
23
+ - **Kishōtenketsu** — Introduction, Development, Twist, Conclusion
24
+ - **Non-fiction: Argument** — Thesis, Evidence, Counter, Synthesis
25
+ - **Non-fiction: Transformation** — Where You Are, Why Stuck, Framework, Apply, Where You'll Be
26
+ - **Custom** — user defines their own beats
27
+
28
+ Save beats: \`book_model_update\` op: "beat_add" for each
29
+
30
+ ## Step 3: Chapter Breakdown
31
+ Map beats to chapters:
32
+ - Each major beat gets at least one chapter
33
+ - Suggest chapter count based on target word count
34
+ - For each chapter: title, synopsis, which beat it fulfills
35
+
36
+ Save: \`book_model_update\` op: "chapter_add" for each
37
+
38
+ ## Step 4: Generate Work Items
39
+ Create one "Chapter" work item per chapter.
40
+
41
+ ## Rules
42
+ - Interactive — discuss structure before committing
43
+ - For fiction: ask about POV style (first/third, single/multiple)
44
+ - For non-fiction: ask about the core argument or transformation
45
+ - Beat percentages are guidelines, not rigid rules`,
46
+ tags: ['book', 'planning', 'structure'],
47
+ });
48
+ export const characterDesignSkill = defineSkill({
49
+ name: 'character-design',
50
+ description: 'Build character profiles, arcs, and relationship maps',
51
+ prompt: `You are in CHARACTER DESIGN MODE. Help the user build their cast.
52
+
53
+ ## Step 1: Read Context
54
+ 1. \`book_model_get\` scope: "characters" for existing characters
55
+ 2. \`book_model_get\` scope: "overview" for book context
56
+
57
+ ## Step 2: Define Characters
58
+ For each character ask:
59
+ - Name, role (protagonist/antagonist/supporting/minor)
60
+ - Brief description
61
+ - Arc: how do they change from beginning to end?
62
+ - Key traits, motivations, flaws
63
+
64
+ Save: \`book_model_update\` op: "character_add"
65
+
66
+ ## Step 3: Map Relationships
67
+ For each significant relationship:
68
+ - Who relates to whom?
69
+ - Type: ally, rival, mentor, family, love, colleague
70
+ - Optional label for nuance
71
+
72
+ Save: \`book_model_update\` op: "character_update" with relationships
73
+
74
+ ## Step 4: Scene Appearances
75
+ Ask which chapters/scenes each character appears in.
76
+ This feeds the Character Map visualization.
77
+
78
+ ## Rules
79
+ - Protagonist needs a clear arc (internal change)
80
+ - Antagonist should have understandable motivations
81
+ - Every character should serve the story — no passengers
82
+ - For non-fiction: "characters" are key concepts with relationships`,
83
+ tags: ['book', 'characters'],
84
+ });
85
+ export const plotThreadsSkill = defineSkill({
86
+ name: 'plot-threads',
87
+ description: 'Define and track plot threads across chapters',
88
+ prompt: `You are in PLOT THREADS MODE. Map the story's narrative threads.
89
+
90
+ ## Step 1: Read Context
91
+ 1. \`book_model_get\` scope: "full" for complete model
92
+ 2. Review existing chapters and beats
93
+
94
+ ## Step 2: Define Threads
95
+ For each plot thread:
96
+ - Name, description
97
+ - Type: main / subplot / background
98
+ - Color (for timeline visualization)
99
+
100
+ Save: \`book_model_update\` op: "thread_add"
101
+
102
+ ## Step 3: Map Threads to Chapters
103
+ For each chapter/scene, identify which threads are active.
104
+ Save via scene updates: \`book_model_update\` op: "scene_update" with plotThreadIds
105
+
106
+ ## Step 4: Balance Check
107
+ - Are there chapters with no active threads? (dead spots)
108
+ - Are subplots resolved before the end?
109
+ - Does the main plot have continuous presence?
110
+ - Do threads converge toward the climax?
111
+
112
+ Report issues and suggest fixes.
113
+
114
+ ## Rules
115
+ - Main plot should be active in most chapters
116
+ - Subplots should connect to the main theme
117
+ - Every thread started must be resolved
118
+ - For non-fiction: threads are argument lines`,
119
+ tags: ['book', 'plotting'],
120
+ });
121
+ export const sceneBreakdownSkill = defineSkill({
122
+ name: 'scene-breakdown',
123
+ description: 'Break a chapter into detailed scenes',
124
+ prompt: `You are in SCENE BREAKDOWN MODE. Detail a chapter's scenes.
125
+
126
+ ## Step 1: Read Context
127
+ 1. \`book_model_get\` scope: "full" for model
128
+ 2. Identify target chapter
129
+
130
+ ## Step 2: Propose Scenes
131
+ For each scene:
132
+ - Title, synopsis
133
+ - Characters present
134
+ - Setting/location
135
+ - Plot threads advanced
136
+ - Themes explored
137
+ - Estimated word count
138
+
139
+ Save: \`book_model_update\` op: "scene_add"
140
+
141
+ ## Step 3: Scene Flow
142
+ - Does each scene end with a hook or transition?
143
+ - Is POV consistent within scenes?
144
+ - Does each scene advance at least one thread?
145
+ - Are character entrances/exits natural?
146
+
147
+ ## Rules
148
+ - Every scene needs a purpose (advances plot, reveals character, or builds world)
149
+ - Avoid scenes that only deliver information
150
+ - Vary scene length for pacing
151
+ - End chapters on moments of tension or decision`,
152
+ tags: ['book', 'scenes'],
153
+ });
154
+ export const bookReviewSkill = defineSkill({
155
+ name: 'book-review',
156
+ description: 'Structural review — beats, arcs, threads, pacing',
157
+ prompt: `You are in BOOK REVIEW MODE. Evaluate the book's structure.
158
+
159
+ ## Step 1: Load
160
+ 1. \`book_model_get\` scope: "full"
161
+ 2. Run \`book_model_validate\`
162
+
163
+ ## Step 2: Beat Coverage
164
+ - Are all beats from the template assigned to chapters?
165
+ - Are beats in the right order and at roughly correct percentages?
166
+ - Flag unassigned beats.
167
+
168
+ ## Step 3: Character Arcs
169
+ - Does the protagonist have a clear arc (start state → end state)?
170
+ - Are supporting characters developed enough?
171
+ - Are there characters who appear but serve no purpose?
172
+
173
+ ## Step 4: Plot Thread Balance
174
+ - Any dead spots (chapters with no active threads)?
175
+ - Are all threads resolved?
176
+ - Does tension build toward the climax?
177
+ - Are subplots properly woven into the main plot?
178
+
179
+ ## Step 5: Pacing
180
+ - Chapter length distribution (are some much longer/shorter?)
181
+ - Scene count per chapter (balance)
182
+ - Ratio of action to reflection scenes
183
+
184
+ ## Step 6: Report
185
+ - Scorecard (beats, characters, threads, pacing)
186
+ - Strengths
187
+ - Critical issues + recommendations
188
+ - Create revision work items
189
+
190
+ ## Rules
191
+ - Focus on structure, not prose
192
+ - Be specific: "Chapter 4 has no active plot thread" not "pacing needs work"
193
+ - 3-5 most impactful recommendations`,
194
+ tags: ['book', 'review', 'structure'],
195
+ });
@@ -1,4 +1,4 @@
1
1
  /**
2
2
  * Platform Skills — barrel export
3
3
  */
4
- export { platformSkills, designSkill, sketchSkill, prdSkill, refineSkill, refineItemSkill, architectureSkill, sessionNotesSkill, buildSkill, scaffoldSkill, outlineSkill, literatureReviewSkill, draftSectionSkill, peerReviewSkill, researchScaffoldSkill, businessVisionSkill, marketAnalysisSkill, competitorAnalysisSkill, financialModelSkill, pitchOutlineSkill, businessReviewSkill, brandSetupSkill, contentStrategySkill, contentCalendarSkill, createContentSkill, contentReviewSkill, curriculumDesignSkill, lessonPlanSkill, assessmentDesignSkill, courseReviewSkill, } from './platform-skills.js';
4
+ export { platformSkills, designSkill, sketchSkill, prdSkill, refineSkill, refineItemSkill, architectureSkill, sessionNotesSkill, buildSkill, scaffoldSkill, outlineSkill, literatureReviewSkill, draftSectionSkill, peerReviewSkill, researchScaffoldSkill, businessVisionSkill, marketAnalysisSkill, competitorAnalysisSkill, financialModelSkill, pitchOutlineSkill, businessReviewSkill, brandSetupSkill, contentStrategySkill, contentCalendarSkill, createContentSkill, contentReviewSkill, curriculumDesignSkill, lessonPlanSkill, assessmentDesignSkill, courseReviewSkill, bookOutlineSkill, characterDesignSkill, plotThreadsSkill, sceneBreakdownSkill, bookReviewSkill, } from './platform-skills.js';
@@ -1,4 +1,4 @@
1
1
  /**
2
2
  * Platform Skills — barrel export
3
3
  */
4
- export { platformSkills, designSkill, sketchSkill, prdSkill, refineSkill, refineItemSkill, architectureSkill, sessionNotesSkill, buildSkill, scaffoldSkill, outlineSkill, literatureReviewSkill, draftSectionSkill, peerReviewSkill, researchScaffoldSkill, businessVisionSkill, marketAnalysisSkill, competitorAnalysisSkill, financialModelSkill, pitchOutlineSkill, businessReviewSkill, brandSetupSkill, contentStrategySkill, contentCalendarSkill, createContentSkill, contentReviewSkill, curriculumDesignSkill, lessonPlanSkill, assessmentDesignSkill, courseReviewSkill, } from './platform-skills.js';
4
+ export { platformSkills, designSkill, sketchSkill, prdSkill, refineSkill, refineItemSkill, architectureSkill, sessionNotesSkill, buildSkill, scaffoldSkill, outlineSkill, literatureReviewSkill, draftSectionSkill, peerReviewSkill, researchScaffoldSkill, businessVisionSkill, marketAnalysisSkill, competitorAnalysisSkill, financialModelSkill, pitchOutlineSkill, businessReviewSkill, brandSetupSkill, contentStrategySkill, contentCalendarSkill, createContentSkill, contentReviewSkill, curriculumDesignSkill, lessonPlanSkill, assessmentDesignSkill, courseReviewSkill, bookOutlineSkill, characterDesignSkill, plotThreadsSkill, sceneBreakdownSkill, bookReviewSkill, } from './platform-skills.js';
@@ -10,7 +10,8 @@ export { outlineSkill, literatureReviewSkill, draftSectionSkill, peerReviewSkill
10
10
  export { businessVisionSkill, marketAnalysisSkill, competitorAnalysisSkill, financialModelSkill, pitchOutlineSkill, businessReviewSkill, } from './business-skills.js';
11
11
  export { brandSetupSkill, contentStrategySkill, contentCalendarSkill, createContentSkill, contentReviewSkill, } from './content-skills.js';
12
12
  export { curriculumDesignSkill, lessonPlanSkill, assessmentDesignSkill, courseReviewSkill, } from './course-skills.js';
13
+ export { bookOutlineSkill, characterDesignSkill, plotThreadsSkill, sceneBreakdownSkill, bookReviewSkill, } from './book-skills.js';
13
14
  /**
14
- * All platform-specific skills (29 total).
15
+ * All platform-specific skills (34 total).
15
16
  */
16
17
  export declare const platformSkills: Skill[];
@@ -14,14 +14,17 @@ export { businessVisionSkill, marketAnalysisSkill, competitorAnalysisSkill, fina
14
14
  export { brandSetupSkill, contentStrategySkill, contentCalendarSkill, createContentSkill, contentReviewSkill, } from './content-skills.js';
15
15
  // Course / Training
16
16
  export { curriculumDesignSkill, lessonPlanSkill, assessmentDesignSkill, courseReviewSkill, } from './course-skills.js';
17
+ // Book
18
+ export { bookOutlineSkill, characterDesignSkill, plotThreadsSkill, sceneBreakdownSkill, bookReviewSkill, } from './book-skills.js';
17
19
  // Import all for the aggregate array
18
20
  import { designSkill, sketchSkill, prdSkill, refineSkill, refineItemSkill, architectureSkill, sessionNotesSkill, buildSkill, scaffoldSkill, } from './software-skills.js';
19
21
  import { outlineSkill, literatureReviewSkill, draftSectionSkill, peerReviewSkill, researchScaffoldSkill, } from './research-skills.js';
20
22
  import { businessVisionSkill, marketAnalysisSkill, competitorAnalysisSkill, financialModelSkill, pitchOutlineSkill, businessReviewSkill, } from './business-skills.js';
21
23
  import { brandSetupSkill, contentStrategySkill, contentCalendarSkill, createContentSkill, contentReviewSkill, } from './content-skills.js';
22
24
  import { curriculumDesignSkill, lessonPlanSkill, assessmentDesignSkill, courseReviewSkill, } from './course-skills.js';
25
+ import { bookOutlineSkill, characterDesignSkill, plotThreadsSkill, sceneBreakdownSkill, bookReviewSkill, } from './book-skills.js';
23
26
  /**
24
- * All platform-specific skills (29 total).
27
+ * All platform-specific skills (34 total).
25
28
  */
26
29
  export const platformSkills = [
27
30
  // Software (9)
@@ -58,4 +61,10 @@ export const platformSkills = [
58
61
  lessonPlanSkill,
59
62
  assessmentDesignSkill,
60
63
  courseReviewSkill,
64
+ // Book (5)
65
+ bookOutlineSkill,
66
+ characterDesignSkill,
67
+ plotThreadsSkill,
68
+ sceneBreakdownSkill,
69
+ bookReviewSkill,
61
70
  ];
@@ -696,7 +696,7 @@ You are the **Researcher** in this multi-agent research team. You specialize in
696
696
  - Argument structure questions → "$default or $reviewer can assess the outline"
697
697
  - Writing/style questions → "$editor can review the prose"
698
698
  - Planning questions → "$default can help with project planning"`,
699
- defaultToolProfile: 'full',
699
+ defaultToolProfile: 'analyst', // Read + search + docs + project (no file writes)
700
700
  defaultModelTier: 'balanced',
701
701
  },
702
702
  reviewer: {
@@ -747,7 +747,7 @@ You are the **Reviewer** in this multi-agent research team. You specialize in va
747
747
  - Source analysis needed → "$researcher can analyze the sources"
748
748
  - Writing quality → "$editor can improve the prose"
749
749
  - Structural changes → "$default can update the outline"`,
750
- defaultToolProfile: 'full',
750
+ defaultToolProfile: 'analyst', // Read-only analysis, no direct editing
751
751
  defaultModelTier: 'balanced',
752
752
  },
753
753
  editor: {
@@ -802,7 +802,7 @@ You are the **Editor** in this multi-agent research team. You specialize in impr
802
802
  - Argument issues → "$reviewer should check the logic here"
803
803
  - Source questions → "$researcher can verify this citation"
804
804
  - Structural changes → "$default can update the outline"`,
805
- defaultToolProfile: 'full',
805
+ defaultToolProfile: 'docs', // Read + write docs, no shell/git
806
806
  defaultModelTier: 'balanced',
807
807
  },
808
808
  writer: {
@@ -823,7 +823,7 @@ You are the **Writer** in this multi-agent team. You specialize in creating comp
823
823
  - Always match the project's established tone and voice
824
824
  - Ask about audience and purpose before writing if not clear
825
825
  - Provide drafts, not final copy — let the Editor refine`,
826
- defaultToolProfile: 'full',
826
+ defaultToolProfile: 'docs', // Read + write docs
827
827
  defaultModelTier: 'balanced',
828
828
  },
829
829
  analyst: {
@@ -844,7 +844,7 @@ You are the **Analyst** in this multi-agent team. You specialize in research, da
844
844
  - Lead with key insights, support with data
845
845
  - Use tables and bullet points for comparisons
846
846
  - Always cite sources and note confidence levels`,
847
- defaultToolProfile: 'full',
847
+ defaultToolProfile: 'analyst', // Read + search + project (read-only analysis)
848
848
  defaultModelTier: 'balanced',
849
849
  },
850
850
  strategist: {
@@ -866,7 +866,7 @@ You are the **Strategist** in this multi-agent team. You specialize in business
866
866
  - Think in frameworks (Porter's Five Forces, Business Model Canvas, etc.)
867
867
  - Always consider market context and competitive landscape
868
868
  - Balance ambition with feasibility`,
869
- defaultToolProfile: 'full',
869
+ defaultToolProfile: 'planner', // Strategy + planning + backlog + docs (read-only)
870
870
  defaultModelTier: 'balanced',
871
871
  },
872
872
  instructor: {
@@ -889,7 +889,7 @@ You are the **Instructor** in this multi-agent team. You specialize in education
889
889
  - Build knowledge progressively — prerequisites first
890
890
  - Include hands-on exercises for every concept
891
891
  - Consider different learning styles`,
892
- defaultToolProfile: 'full',
892
+ defaultToolProfile: 'docs', // Read + write educational content
893
893
  defaultModelTier: 'balanced',
894
894
  },
895
895
  custom: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@compilr-dev/sdk",
3
- "version": "0.7.8",
3
+ "version": "0.7.10",
4
4
  "description": "Universal agent runtime for building AI-powered applications",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",