@compilr-dev/sdk 0.5.5 → 0.5.7

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/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, } from './skills/index.js';
64
+ export { platformSkills, designSkill, sketchSkill, prdSkill, refineSkill, refineItemSkill, architectureSkill, sessionNotesSkill, buildSkill, scaffoldSkill, outlineSkill, literatureReviewSkill, draftSectionSkill, } 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, getProjectTypesByCategory, generalConfig, softwareConfig, researchConfig, businessPlanConfig, contentConfig, techDocsConfig, courseConfig, } 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, } from './skills/index.js';
142
+ export { platformSkills, designSkill, sketchSkill, prdSkill, refineSkill, refineItemSkill, architectureSkill, sessionNotesSkill, buildSkill, scaffoldSkill, outlineSkill, literatureReviewSkill, draftSectionSkill, } from './skills/index.js';
143
143
  // =============================================================================
144
144
  // Contextual Actions (skill invocations with context)
145
145
  // =============================================================================
@@ -154,8 +154,8 @@ export const researchConfig = {
154
154
  { type: 'bibliography', label: 'Bibliography', description: 'References and citations' },
155
155
  { type: 'session-notes', label: 'Session Notes', description: 'Summary of work done' },
156
156
  ],
157
- projectActions: ['outline', 'session-notes'],
158
- workItemActions: ['explain'],
157
+ projectActions: ['outline', 'literature-review', 'draft-section', 'session-notes'],
158
+ workItemActions: ['draft-section', 'explain'],
159
159
  workItemLabels: {
160
160
  feature: { short: 'SC', full: 'Section' },
161
161
  bug: { short: 'RV', full: 'Revision' },
@@ -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, } from './platform-skills.js';
4
+ export { platformSkills, designSkill, sketchSkill, prdSkill, refineSkill, refineItemSkill, architectureSkill, sessionNotesSkill, buildSkill, scaffoldSkill, outlineSkill, literatureReviewSkill, draftSectionSkill, } 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, } from './platform-skills.js';
4
+ export { platformSkills, designSkill, sketchSkill, prdSkill, refineSkill, refineItemSkill, architectureSkill, sessionNotesSkill, buildSkill, scaffoldSkill, outlineSkill, literatureReviewSkill, draftSectionSkill, } from './platform-skills.js';
@@ -18,8 +18,10 @@ export declare const sessionNotesSkill: Skill;
18
18
  export declare const buildSkill: Skill;
19
19
  export declare const scaffoldSkill: Skill;
20
20
  export declare const outlineSkill: Skill;
21
+ export declare const literatureReviewSkill: Skill;
22
+ export declare const draftSectionSkill: Skill;
21
23
  /**
22
- * All platform-specific skills (10 total).
24
+ * All platform-specific skills (11 total).
23
25
  * These skills reference platform tools (backlog, workitems, documents, projects)
24
26
  * and belong in the SDK rather than in generic agent/coding libraries.
25
27
  */
@@ -990,11 +990,227 @@ Create one work item per section:
990
990
  ✓ User has reviewed and approved the outline`,
991
991
  tags: ['research', 'planning', 'outline'],
992
992
  });
993
+ export const literatureReviewSkill = defineSkill({
994
+ name: 'literature-review',
995
+ description: 'Analyze sources from the Knowledge Base — extract findings, link to claims, identify gaps',
996
+ prompt: `You are in LITERATURE REVIEW MODE. Your goal is to systematically analyze the sources in the Knowledge Base and connect them to the Research Model's sections and claims.
997
+
998
+ ## When to Use
999
+ - Sources have been added to the Knowledge Base but not yet analyzed
1000
+ - The Research Model has sections/claims that need source support
1001
+ - User wants to understand how sources relate to their argument
1002
+ - User wants to identify gaps in their source coverage
1003
+
1004
+ ## Prerequisites
1005
+ - A Research Model should exist (run /outline first if not)
1006
+ - Sources should be in the Knowledge Base (upload PDFs, paste text, or import URLs)
1007
+
1008
+ ## Step 1: Assess Current State
1009
+
1010
+ 1. Use \`research_model_get\` with scope: "overview" to see the current model
1011
+ 2. Use \`research_model_get\` with scope: "sources" to see which sources are already registered and analyzed
1012
+ 3. Review the Knowledge Base content (pinned items are in context; read non-pinned files as needed)
1013
+
1014
+ Report to the user:
1015
+ - "You have X sources in the model, Y analyzed, Z unanalyzed"
1016
+ - "The Knowledge Base has N files available"
1017
+ - "X claims currently lack source support"
1018
+
1019
+ ## Step 2: Register New Sources
1020
+
1021
+ For each KB document not yet in the Research Model:
1022
+ 1. Read the document content (use \`read_file\` if not pinned)
1023
+ 2. Extract citation information: authors, title, year, venue, type
1024
+ 3. Register it: \`research_model_update\` with op: "source_add", source: { citeKey, citation: { type, title, authors, year, venue } }
1025
+ 4. Note: generate a short, memorable citeKey (e.g., "smith2024", "jones-ml-2023")
1026
+
1027
+ Ask the user to confirm the extracted citation info for each source, or batch-confirm if there are many.
1028
+
1029
+ ## Step 3: Analyze Each Source
1030
+
1031
+ For each unanalyzed source:
1032
+ 1. Read the full content from the KB
1033
+ 2. Extract key findings relevant to the paper's research questions
1034
+ 3. Identify the source's methodology and limitations
1035
+ 4. Determine relevance: primary (directly addresses research questions), secondary (provides context), or background (general knowledge)
1036
+ 5. Update the source: \`research_model_update\` with op: "source_update", sourceId: "...", updates: { keyFindings: [...], relevance: "primary|secondary|background", analyzed: true, tags: [...] }
1037
+
1038
+ Present a summary of each source's key findings to the user.
1039
+
1040
+ ## Step 4: Link Sources to Claims
1041
+
1042
+ For each section in the model:
1043
+ 1. Read the section's existing claims (\`research_model_get\` with sectionId)
1044
+ 2. For each claim, identify which analyzed sources support or contradict it
1045
+ 3. Link them: \`research_model_update\` with op: "claim_link_source", sectionId, claimId, sourceRef: { sourceId, relevance: "brief note" }, relation: "supporting" or "contradicting"
1046
+ 4. Update evidence strength based on the linked sources:
1047
+ - strong: multiple supporting sources, no contradictions
1048
+ - moderate: at least one supporting source
1049
+ - weak: tangential support only
1050
+ - contested: sources disagree
1051
+ - unsupported: no sources linked
1052
+
1053
+ If a source suggests a claim that doesn't exist yet, propose adding it:
1054
+ - \`research_model_update\` with op: "claim_add", sectionId, claim: { statement, type: "derived" }
1055
+
1056
+ ## Step 5: Identify Gaps
1057
+
1058
+ After linking sources to claims, analyze gaps:
1059
+ 1. Run \`research_model_validate\` to get warnings
1060
+ 2. Report:
1061
+ - **Unsupported claims** — claims with no source references (need more sources or should be marked as original analysis)
1062
+ - **Orphan sources** — sources not linked to any claim (may not be relevant, or claims are missing)
1063
+ - **Thin sections** — sections with few claims or few sources
1064
+ - **Missing perspectives** — if all sources agree, note the lack of counter-arguments
1065
+
1066
+ Suggest next steps:
1067
+ - "Section X needs more sources on [topic] — consider searching for..."
1068
+ - "Source Y has findings relevant to Section Z but no claim captures this yet"
1069
+ - "The paper lacks counter-arguments on [claim] — consider adding a limitations discussion"
1070
+
1071
+ ## Step 6: Synthesize Themes
1072
+
1073
+ If multiple sources have been analyzed, provide a thematic synthesis:
1074
+ - Group sources by the themes they address
1075
+ - Note where sources agree, where they disagree, and what's novel
1076
+ - Map themes to research questions
1077
+ - Suggest how themes should be organized in the Literature Review section
1078
+
1079
+ ## Rules
1080
+ - Analyze sources ONE AT A TIME — don't rush through multiple sources
1081
+ - Ask the user to confirm citation info before saving (batch OK for many sources)
1082
+ - Always distinguish between the source's claims and the user's interpretation
1083
+ - Note methodological differences between sources when relevant
1084
+ - Use citeKeys consistently when referencing sources
1085
+ - If a source is irrelevant to the research, say so — not every KB file needs to be in the model
1086
+ - Keep evidence strength assessments conservative — "moderate" is better than over-claiming "strong"
1087
+
1088
+ ## Completion Criteria
1089
+ ✓ All relevant KB sources are registered in the model
1090
+ ✓ Each source has been analyzed (keyFindings, relevance, tags)
1091
+ ✓ Sources are linked to relevant claims
1092
+ ✓ Evidence strength updated for linked claims
1093
+ ✓ Gaps identified and reported
1094
+ ✓ User has reviewed the source-claim mappings`,
1095
+ tags: ['research', 'analysis', 'sources'],
1096
+ });
1097
+ export const draftSectionSkill = defineSkill({
1098
+ name: 'draft-section',
1099
+ description: 'Draft a paper section using the outline, claims, and linked sources',
1100
+ prompt: `You are in DRAFT SECTION MODE. Your goal is to write or revise a section of the research paper, guided by the Research Model's outline, claims, and linked sources.
1101
+
1102
+ ## When to Use
1103
+ - A section has status "outlined" and needs its first draft
1104
+ - A section needs revision based on reviewer feedback
1105
+ - The user wants to expand a section with more detail
1106
+
1107
+ ## Step 1: Select the Section
1108
+
1109
+ 1. Use \`research_model_get\` with scope: "sections" to see all sections and their status
1110
+ 2. If the user didn't specify which section, suggest the next logical one:
1111
+ - Methodology first (grounds the paper)
1112
+ - Literature Review (needed early)
1113
+ - Results / Findings (core content)
1114
+ - Discussion (interpretation)
1115
+ - Introduction and Conclusion last (summaries)
1116
+ 3. Confirm the section choice with the user
1117
+
1118
+ ## Step 2: Gather Section Context
1119
+
1120
+ For the chosen section:
1121
+ 1. Use \`research_model_get\` with sectionId to get the section's purpose, claims, and notes
1122
+ 2. Read any existing draft file (if the section has been drafted before)
1123
+ 3. For each claim with linked sources, read the source content from KB to understand the evidence
1124
+ 4. Check the citation style from the model: \`research_model_get\` with scope: "overview"
1125
+
1126
+ Summarize to the user:
1127
+ - "Section: {title}"
1128
+ - "Purpose: {purpose}"
1129
+ - "Claims to address: {list}"
1130
+ - "Sources available: {list with citeKeys}"
1131
+
1132
+ ## Step 3: Draft the Section
1133
+
1134
+ Write the section following these guidelines:
1135
+
1136
+ **Structure:**
1137
+ - Start with a topic sentence that states the section's purpose
1138
+ - Address each claim in the section in a logical order
1139
+ - Use transitions between paragraphs
1140
+ - End with a connection to the next section (or summary for final sections)
1141
+
1142
+ **Citations:**
1143
+ - Use the project's citation style for in-text citations
1144
+ - APA: (Author, Year) or Author (Year)
1145
+ - MLA: (Author Page) or Author (Page)
1146
+ - IEEE: [citeKey] or [N]
1147
+ - Chicago: (Author Year) or Author (Year)
1148
+ - Harvard: (Author Year) or Author (Year)
1149
+ - Cite sources for every non-original claim
1150
+ - When multiple sources support a claim, cite them together
1151
+
1152
+ **Academic Tone:**
1153
+ - Formal but clear — avoid jargon without definition
1154
+ - Use hedging language where appropriate ("suggests", "indicates", "appears to")
1155
+ - Distinguish between established facts and interpretations
1156
+ - Use active voice for the author's contributions, passive for general findings
1157
+
1158
+ **Length:**
1159
+ - Respect the section's targetWordCount if set
1160
+ - If not set, aim for appropriate length based on scope:
1161
+ - Journal article section: 500-1500 words
1162
+ - Thesis chapter: 2000-5000 words
1163
+ - Literature review section: 800-2000 words
1164
+
1165
+ ## Step 4: Write the File
1166
+
1167
+ 1. Determine the file path: \`{project_path}/sections/{section_order}-{section_slug}.md\`
1168
+ - e.g., \`sections/01-introduction.md\`, \`sections/03-methodology.md\`
1169
+ 2. Write the draft using \`write_file\` or \`edit_file\` (if revising)
1170
+ 3. Include a header comment: \`<!-- Section: {title} | Status: drafted | Rev: {model revision} -->\`
1171
+
1172
+ ## Step 5: Update the Model
1173
+
1174
+ After writing:
1175
+ 1. Update section status: \`research_model_update\` with op: "section_update", sectionId, updates: { status: "drafted", actualWordCount: N }
1176
+ 2. If new claims emerged during writing, add them: \`research_model_update\` with op: "claim_add"
1177
+ 3. If evidence strength changed based on closer reading, update claims
1178
+
1179
+ ## Step 6: Generate Bibliography (if needed)
1180
+
1181
+ If this is the first section being drafted or the user requests it:
1182
+ 1. Use \`bibliography_generate\` with format: "markdown" to produce the references list
1183
+ 2. Write it to \`{project_path}/sections/references.md\`
1184
+
1185
+ ## Step 7: Summary
1186
+
1187
+ Report to the user:
1188
+ - Section drafted: title, word count, file path
1189
+ - Claims addressed: list with evidence strength
1190
+ - Citations used: list of citeKeys
1191
+ - Suggestions: any gaps noticed, claims that need more support
1192
+
1193
+ ## Rules
1194
+ - NEVER fabricate citations — only cite sources that exist in the Research Model
1195
+ - If a claim lacks source support, note it explicitly rather than inventing a reference
1196
+ - Maintain consistency with previously drafted sections (terminology, tense, voice)
1197
+ - If the section has subsections in the model, draft them as ## subheadings
1198
+ - Read existing drafted sections first to maintain consistent style
1199
+ - Ask the user about tone preferences if this is the first section being drafted
1200
+
1201
+ ## Completion Criteria
1202
+ ✓ Section file written with proper citations
1203
+ ✓ Model updated (status: drafted, actualWordCount)
1204
+ ✓ All claims in the section are addressed in the text
1205
+ ✓ In-text citations match the project's citation style
1206
+ ✓ User has reviewed the draft`,
1207
+ tags: ['research', 'writing', 'drafting'],
1208
+ });
993
1209
  // =============================================================================
994
1210
  // Aggregate export
995
1211
  // =============================================================================
996
1212
  /**
997
- * All platform-specific skills (10 total).
1213
+ * All platform-specific skills (11 total).
998
1214
  * These skills reference platform tools (backlog, workitems, documents, projects)
999
1215
  * and belong in the SDK rather than in generic agent/coding libraries.
1000
1216
  */
@@ -1009,4 +1225,6 @@ export const platformSkills = [
1009
1225
  buildSkill,
1010
1226
  scaffoldSkill,
1011
1227
  outlineSkill,
1228
+ literatureReviewSkill,
1229
+ draftSectionSkill,
1012
1230
  ];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@compilr-dev/sdk",
3
- "version": "0.5.5",
3
+ "version": "0.5.7",
4
4
  "description": "Universal agent runtime for building AI-powered applications",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",