@compilr-dev/sdk 0.5.6 → 0.5.8

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, literatureReviewSkill, } from './skills/index.js';
64
+ export { platformSkills, designSkill, sketchSkill, prdSkill, refineSkill, refineItemSkill, architectureSkill, sessionNotesSkill, buildSkill, scaffoldSkill, outlineSkill, literatureReviewSkill, draftSectionSkill, peerReviewSkill, } 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, literatureReviewSkill, } from './skills/index.js';
142
+ export { platformSkills, designSkill, sketchSkill, prdSkill, refineSkill, refineItemSkill, architectureSkill, sessionNotesSkill, buildSkill, scaffoldSkill, outlineSkill, literatureReviewSkill, draftSectionSkill, peerReviewSkill, } 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', 'literature-review', 'session-notes'],
158
- workItemActions: ['explain'],
157
+ projectActions: ['outline', 'literature-review', 'draft-section', 'peer-review', '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, literatureReviewSkill, } from './platform-skills.js';
4
+ export { platformSkills, designSkill, sketchSkill, prdSkill, refineSkill, refineItemSkill, architectureSkill, sessionNotesSkill, buildSkill, scaffoldSkill, outlineSkill, literatureReviewSkill, draftSectionSkill, peerReviewSkill, } 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, } from './platform-skills.js';
4
+ export { platformSkills, designSkill, sketchSkill, prdSkill, refineSkill, refineItemSkill, architectureSkill, sessionNotesSkill, buildSkill, scaffoldSkill, outlineSkill, literatureReviewSkill, draftSectionSkill, peerReviewSkill, } from './platform-skills.js';
@@ -19,8 +19,10 @@ export declare const buildSkill: Skill;
19
19
  export declare const scaffoldSkill: Skill;
20
20
  export declare const outlineSkill: Skill;
21
21
  export declare const literatureReviewSkill: Skill;
22
+ export declare const draftSectionSkill: Skill;
23
+ export declare const peerReviewSkill: Skill;
22
24
  /**
23
- * All platform-specific skills (11 total).
25
+ * All platform-specific skills (13 total).
24
26
  * These skills reference platform tools (backlog, workitems, documents, projects)
25
27
  * and belong in the SDK rather than in generic agent/coding libraries.
26
28
  */
@@ -1094,11 +1094,272 @@ If multiple sources have been analyzed, provide a thematic synthesis:
1094
1094
  ✓ User has reviewed the source-claim mappings`,
1095
1095
  tags: ['research', 'analysis', 'sources'],
1096
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
+ });
1209
+ export const peerReviewSkill = defineSkill({
1210
+ name: 'peer-review',
1211
+ description: 'Validate argument structure, find logical gaps, check consistency across sections',
1212
+ prompt: `You are in PEER REVIEW MODE. Your goal is to critically evaluate the research paper's argument structure, identify gaps, and check consistency — like an academic peer reviewer.
1213
+
1214
+ ## When to Use
1215
+ - One or more sections have been drafted
1216
+ - The user wants feedback before submitting/finalizing
1217
+ - After significant revisions to check nothing was broken
1218
+ - To identify areas that need more work
1219
+
1220
+ ## Step 1: Assess What's Available
1221
+
1222
+ 1. Use \`research_model_get\` with scope: "overview" for the big picture
1223
+ 2. Use \`research_model_get\` with scope: "sections" to see status of each section
1224
+ 3. Run \`research_model_validate\` for structural issues and warnings
1225
+
1226
+ Report to the user:
1227
+ - "X sections drafted, Y still outlined, Z sources linked"
1228
+ - Any structural errors from validation
1229
+ - Which sections are ready for review
1230
+
1231
+ If no sections are drafted yet, tell the user: "There's nothing to review yet — run /draft-section first."
1232
+
1233
+ ## Step 2: Argument Structure Review
1234
+
1235
+ Read each drafted section (use \`read_file\` on the section files) and evaluate:
1236
+
1237
+ **Thesis & Research Questions:**
1238
+ - Is the main thesis clearly stated in the Introduction?
1239
+ - Does each section contribute to answering the research questions?
1240
+ - Are the research questions actually addressed by the paper's content?
1241
+
1242
+ **Logical Flow:**
1243
+ - Does the argument progress logically from Introduction → Literature Review → Methodology → Results → Discussion → Conclusion?
1244
+ - Does each section build on what came before?
1245
+ - Are there logical jumps or non-sequiturs between sections?
1246
+
1247
+ **Claim Validation:**
1248
+ For each claim in the Research Model:
1249
+ - Is it actually stated in the draft text?
1250
+ - Is it supported by the cited sources?
1251
+ - Is the evidence strength rating accurate given the sources?
1252
+ - Are there unsupported assertions presented as established facts?
1253
+
1254
+ Rate each issue found:
1255
+ - **Critical** — breaks the argument (e.g., unsupported central claim, circular reasoning)
1256
+ - **Major** — weakens the argument significantly (e.g., missing counter-arguments, logical gap)
1257
+ - **Minor** — should be fixed but doesn't break the argument (e.g., vague language, minor inconsistency)
1258
+
1259
+ ## Step 3: Gap Detection
1260
+
1261
+ Check for missing elements:
1262
+
1263
+ **Source Gaps:**
1264
+ - Claims that should have citations but don't
1265
+ - Sections that rely on very few sources
1266
+ - Important counter-arguments not addressed
1267
+ - Methodology claims without justification
1268
+
1269
+ **Structural Gaps:**
1270
+ - Research questions not addressed by any section
1271
+ - Sections that don't connect to the overall argument
1272
+ - Missing limitations discussion
1273
+ - Missing future work section (if appropriate)
1274
+
1275
+ **Content Gaps:**
1276
+ - Definitions used but never introduced
1277
+ - Acronyms used without expansion
1278
+ - Figures/tables referenced but not present
1279
+ - Promises made in the Introduction but not delivered
1280
+
1281
+ ## Step 4: Consistency Check
1282
+
1283
+ Across all drafted sections, check:
1284
+
1285
+ **Terminology:**
1286
+ - Is the same concept referred to consistently? (e.g., not "users" in one place and "participants" in another without reason)
1287
+ - Are technical terms used with consistent meaning?
1288
+
1289
+ **Tense:**
1290
+ - Literature review: past tense for completed studies
1291
+ - Methodology: past tense for what was done, present for general statements
1292
+ - Results: past tense for findings
1293
+ - Discussion: present tense for interpretations
1294
+
1295
+ **Voice & Tone:**
1296
+ - Is the level of formality consistent?
1297
+ - Is the author's voice consistent (not shifting between confident and hedging without reason)?
1298
+
1299
+ **Numbers & Data:**
1300
+ - Do statistics match between text and any tables/figures?
1301
+ - Are numbers formatted consistently?
1302
+
1303
+ ## Step 5: Cross-Reference Check
1304
+
1305
+ - "As discussed in Section X" — does Section X actually discuss that?
1306
+ - "See Table N" / "See Figure N" — do they exist?
1307
+ - Citations in text match sources in the Research Model
1308
+ - Consistent use of citation style throughout
1309
+
1310
+ ## Step 6: Generate Review Report
1311
+
1312
+ Structure the report as:
1313
+
1314
+ ### Strengths
1315
+ - What the paper does well (2-3 points)
1316
+
1317
+ ### Critical Issues
1318
+ - Issues that must be addressed (with specific locations)
1319
+
1320
+ ### Major Issues
1321
+ - Significant improvements needed
1322
+
1323
+ ### Minor Issues
1324
+ - Small fixes and suggestions
1325
+
1326
+ ### Recommendations
1327
+ - Prioritized list of what to fix first
1328
+ - Suggested order of revisions
1329
+
1330
+ Write the report to \`{project_path}/reviews/peer-review-{date}.md\`
1331
+
1332
+ ## Step 7: Update Model
1333
+
1334
+ For issues that affect the Research Model:
1335
+ 1. Update claim evidence strength if ratings were inaccurate
1336
+ 2. Add new claims if the review identified missing arguments
1337
+ 3. Create work items (type: "bug" / displayed as "Revision") for each critical and major issue:
1338
+ - \`workitem_create\` with type: "bug", title: "Review: {brief issue}", description: detailed issue + suggested fix
1339
+
1340
+ ## Rules
1341
+ - Be constructive, not destructive — every critique should include a suggestion for improvement
1342
+ - Reference specific sections, claims, and sources by ID/citeKey
1343
+ - Don't rewrite the paper — point out issues and let the author fix them
1344
+ - Distinguish between opinion ("I would suggest...") and errors ("This claim is unsupported")
1345
+ - If the argument is sound, say so — don't manufacture problems
1346
+ - Focus on the argument, not the writing style (that's the Editor's job)
1347
+
1348
+ ## Completion Criteria
1349
+ ✓ All drafted sections reviewed
1350
+ ✓ Argument structure evaluated (thesis, logical flow, claim support)
1351
+ ✓ Gaps identified (source, structural, content)
1352
+ ✓ Consistency checked (terminology, tense, cross-references)
1353
+ ✓ Review report written to file
1354
+ ✓ Revision work items created for critical/major issues
1355
+ ✓ User has received the review summary`,
1356
+ tags: ['research', 'review', 'quality'],
1357
+ });
1097
1358
  // =============================================================================
1098
1359
  // Aggregate export
1099
1360
  // =============================================================================
1100
1361
  /**
1101
- * All platform-specific skills (11 total).
1362
+ * All platform-specific skills (13 total).
1102
1363
  * These skills reference platform tools (backlog, workitems, documents, projects)
1103
1364
  * and belong in the SDK rather than in generic agent/coding libraries.
1104
1365
  */
@@ -1114,4 +1375,6 @@ export const platformSkills = [
1114
1375
  scaffoldSkill,
1115
1376
  outlineSkill,
1116
1377
  literatureReviewSkill,
1378
+ draftSectionSkill,
1379
+ peerReviewSkill,
1117
1380
  ];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@compilr-dev/sdk",
3
- "version": "0.5.6",
3
+ "version": "0.5.8",
4
4
  "description": "Universal agent runtime for building AI-powered applications",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",