@compilr-dev/sdk 0.5.2 → 0.5.4

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, } from './skills/index.js';
64
+ export { platformSkills, designSkill, sketchSkill, prdSkill, refineSkill, refineItemSkill, architectureSkill, sessionNotesSkill, buildSkill, scaffoldSkill, outlineSkill, } 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, } from './skills/index.js';
142
+ export { platformSkills, designSkill, sketchSkill, prdSkill, refineSkill, refineItemSkill, architectureSkill, sessionNotesSkill, buildSkill, scaffoldSkill, outlineSkill, } from './skills/index.js';
143
143
  // =============================================================================
144
144
  // Contextual Actions (skill invocations with context)
145
145
  // =============================================================================
@@ -154,7 +154,7 @@ 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: ['session-notes'],
157
+ projectActions: ['outline', 'session-notes'],
158
158
  workItemActions: ['explain'],
159
159
  workItemLabels: {
160
160
  feature: { short: 'SC', full: 'Section' },
@@ -163,6 +163,70 @@ export const researchConfig = {
163
163
  chore: { short: 'TK', full: 'Task' },
164
164
  },
165
165
  systemPromptContext: 'This is an academic research project. The user is writing a research paper or thesis. Focus on academic rigor, proper citations, and structured argumentation.',
166
+ systemPromptSection: `## Project Context: Research Paper
167
+
168
+ You are assisting with an academic research project. Your role is to help the user develop a well-structured, properly cited research paper.
169
+
170
+ ### Research Workflow
171
+ The typical research workflow progresses through these phases:
172
+ 1. **Topic Definition** — Define research questions and scope
173
+ 2. **Literature Review** — Find, analyze, and synthesize sources
174
+ 3. **Outline** — Build the paper's argument structure
175
+ 4. **Drafting** — Write sections guided by the outline and sources
176
+ 5. **Review** — Validate argument, check consistency, identify gaps
177
+ 6. **Revision** — Refine based on review feedback
178
+
179
+ The user may be at any stage. Assess where they are before suggesting next steps.
180
+
181
+ ### Research Model
182
+ This project uses a **Research Model** — a structured representation of the paper stored as a document (doc_type: "research-model"). It tracks:
183
+ - **Sections** — the paper's hierarchical structure, each with a purpose and status
184
+ - **Claims** — assertions made within sections, with evidence strength ratings
185
+ - **Sources** — reference material from the Knowledge Base, linked to claims
186
+ - **Research Questions** — the driving questions the paper addresses
187
+
188
+ Use the research model tools to read and update this model:
189
+ - \`research_model_get\` — read the model (use scope: "overview" for a quick summary)
190
+ - \`research_model_update\` — add/modify sections, claims, sources, questions
191
+ - \`research_model_validate\` — check for structural errors and research-quality warnings
192
+
193
+ Always consult the model before making structural suggestions. Update it when the user makes decisions about paper structure.
194
+
195
+ ### Working with Sources
196
+ Reference material is stored in the project's Knowledge Base. When the user uploads or imports a source:
197
+ - Extract key findings relevant to their research questions
198
+ - Identify which claims the source supports or contradicts
199
+ - Link the source to the appropriate claims via \`research_model_update\` (claim_link_source)
200
+ - Mark the source as analyzed when done
201
+
202
+ ### Writing Conventions
203
+ - Every claim that isn't the author's original analysis should be traceable to a source
204
+ - Use formal academic tone unless the user indicates otherwise
205
+ - Maintain consistent terminology across sections
206
+ - Distinguish between the user's original analysis and source-derived information
207
+ - Follow the project's citation style (check the model's citationStyle field)
208
+
209
+ ### Work Items
210
+ Work items in this project represent:
211
+ - **Section** (type: feature) — a section to draft or revise
212
+ - **Revision** (type: bug) — an issue to fix in the argument or content
213
+ - **Reference** (type: tech-debt) — a source to find or analyze
214
+ - **Task** (type: chore) — general administrative work
215
+
216
+ ### Team Agents
217
+ Specialized agents may be available on the team:
218
+ - **Researcher** — deep analysis of sources, literature synthesis, evidence evaluation
219
+ - **Reviewer** — argument validation, gap detection, consistency checking
220
+ - **Editor** — style, clarity, grammar, voice consistency
221
+
222
+ Suggest delegation when a task would benefit from focused expertise. For example, delegate source analysis to the Researcher, or argument review to the Reviewer.
223
+
224
+ ### Available Skills
225
+ - \`/outline\` — build or refine the paper's section structure
226
+ - \`/literature-review\` — analyze sources and link to claims (when available)
227
+ - \`/draft-section\` — write a section using outline + claims + sources (when available)
228
+ - \`/peer-review\` — validate argument structure and consistency (when available)
229
+ - \`/session-notes\` — summarize work done in this session`,
166
230
  };
167
231
  // =============================================================================
168
232
  // Business Plan / Startup
@@ -68,6 +68,8 @@ export interface ProjectTypeConfig {
68
68
  short: string;
69
69
  full: string;
70
70
  }>>;
71
- /** Context line injected into the system prompt */
71
+ /** Context line injected into the system prompt (one-liner, deprecated — use systemPromptSection) */
72
72
  systemPromptContext: string;
73
+ /** Rich multi-line system prompt section for the default agent. Takes precedence over systemPromptContext. */
74
+ systemPromptSection?: string;
73
75
  }
@@ -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, } from './platform-skills.js';
4
+ export { platformSkills, designSkill, sketchSkill, prdSkill, refineSkill, refineItemSkill, architectureSkill, sessionNotesSkill, buildSkill, scaffoldSkill, outlineSkill, } 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, } from './platform-skills.js';
4
+ export { platformSkills, designSkill, sketchSkill, prdSkill, refineSkill, refineItemSkill, architectureSkill, sessionNotesSkill, buildSkill, scaffoldSkill, outlineSkill, } from './platform-skills.js';
@@ -17,8 +17,9 @@ export declare const prdSkill: Skill;
17
17
  export declare const sessionNotesSkill: Skill;
18
18
  export declare const buildSkill: Skill;
19
19
  export declare const scaffoldSkill: Skill;
20
+ export declare const outlineSkill: Skill;
20
21
  /**
21
- * All platform-specific skills (9 total).
22
+ * All platform-specific skills (10 total).
22
23
  * These skills reference platform tools (backlog, workitems, documents, projects)
23
24
  * and belong in the SDK rather than in generic agent/coding libraries.
24
25
  */
@@ -844,10 +844,157 @@ Create both frontend and backend structures:
844
844
  version: '1.0.0',
845
845
  });
846
846
  // =============================================================================
847
+ // Research Skills
848
+ // =============================================================================
849
+ export const outlineSkill = defineSkill({
850
+ name: 'outline',
851
+ description: 'Build or refine the research paper structure — sections, claims, source mapping',
852
+ prompt: `You are in OUTLINE MODE. Your goal is to help the user build or refine a structured outline for their research paper using the Research Model.
853
+
854
+ ## When to Use
855
+ - Starting a new research paper — no outline exists yet
856
+ - Restructuring an existing paper — user wants to reorganize sections
857
+ - Evolving a paper — new sources or insights change the direction
858
+ - Importing structure — user has an existing paper and wants to model it
859
+
860
+ ## Step 1: Assess Current State
861
+
862
+ Start by reading the current state:
863
+ 1. Use \`research_model_get\` with scope: "overview" to check if a model exists
864
+ 2. If it exists, review sections, questions, and sources already defined
865
+ 3. Check the Knowledge Base (read pinned content) for available sources
866
+ 4. Check existing work items with \`workitem_query\`
867
+
868
+ Tell the user what you found:
869
+ - "You have X sections, Y sources, Z research questions defined" (if model exists)
870
+ - "No research model found yet — let's build one from scratch" (if new)
871
+
872
+ ## Step 2: Gather Context (only ask what you don't already know)
873
+
874
+ Ask in batches of 2-3 questions:
875
+ - **Research topic:** What is the main topic or research question?
876
+ - **Scope:** What type of paper? (journal article, thesis chapter, full thesis, literature review, lab report)
877
+ - **Citation style:** APA, MLA, Chicago, IEEE, Harvard?
878
+ - **Audience:** Who is this for? (academic journal, conference, class assignment)
879
+ - **Constraints:** Any required sections or structure mandated by the target venue?
880
+
881
+ If the model already has a title and citation style set, skip those questions.
882
+
883
+ After gathering answers, save the metadata:
884
+ - \`research_model_update\` with op: "set_title"
885
+ - \`research_model_update\` with op: "set_citation_style"
886
+ - \`research_model_update\` with op: "set_authors" (if provided)
887
+ - \`research_model_update\` with op: "set_keywords" (if provided)
888
+
889
+ ## Step 3: Propose Research Questions
890
+
891
+ Based on the topic and available sources, propose:
892
+ - One main research question
893
+ - 2-4 sub-questions the paper will address
894
+
895
+ Present them to the user for review. After confirmation, save each:
896
+ - \`research_model_update\` with op: "question_add", question: { question: "..." }
897
+
898
+ ## Step 4: Propose Section Structure
899
+
900
+ Based on the questions, scope, and sources, propose an outline. Adapt to the paper type:
901
+
902
+ **Journal article (5-7 sections):**
903
+ 1. Introduction — state the problem, thesis, and contribution
904
+ 2. Literature Review / Related Work — what's known, what's the gap
905
+ 3. Methodology — research approach
906
+ 4. Results / Findings — present the evidence
907
+ 5. Discussion — interpret results, implications, limitations
908
+ 6. Conclusion — summarize contributions, future work
909
+
910
+ **Thesis (chapters with subsections):**
911
+ - Chapters as top-level sections, subsections as children
912
+ - Include: Abstract, Acknowledgments if appropriate
913
+
914
+ **Literature review (thematic):**
915
+ - Organized by themes, not methodology/results
916
+ - Each theme is a section with sub-themes as subsections
917
+
918
+ **Lab report:**
919
+ - Hypothesis, Method, Results, Discussion, Conclusion
920
+
921
+ Present the outline to the user. For each section include:
922
+ - Title
923
+ - Purpose (what this section argues or establishes — not just "discusses X" but "argues that X because Y")
924
+ - Estimated word count (if appropriate for the scope)
925
+
926
+ After user confirms/adjusts, save each section:
927
+ - \`research_model_update\` with op: "section_add", section: { title, purpose, order, parentId, targetWordCount }
928
+
929
+ For subsections, use parentId referencing the parent section's ID.
930
+
931
+ ## Step 5: Map Sources to Sections (if sources exist in KB)
932
+
933
+ If the Knowledge Base has sources:
934
+ 1. Review available source descriptions/pinned content
935
+ 2. For each section, suggest which sources might be relevant
936
+ 3. Create initial claim sketches for key arguments
937
+ 4. Link sources to claims
938
+
939
+ For each claim:
940
+ - \`research_model_update\` with op: "claim_add", sectionId: "...", claim: { statement: "..." }
941
+
942
+ For each source link (only if source is already in the model):
943
+ - \`research_model_update\` with op: "claim_link_source", sectionId: "...", claimId: "...", sourceRef: { sourceId: "..." }, relation: "supporting"
944
+
945
+ If no sources exist yet, skip this step and note: "Add sources to the Knowledge Base and run /literature-review to link them."
946
+
947
+ ## Step 6: Generate Work Items
948
+
949
+ Create one work item per section:
950
+ - Use \`workitem_create\` for each section
951
+ - Type: "feature" (displayed as "Section" in research projects)
952
+ - Title: "Draft: {section title}"
953
+ - Description: Include section purpose, key claims to address, relevant sources
954
+ - Priority based on writing order:
955
+ - Methodology → high (write first, grounds the paper)
956
+ - Literature Review → high (needed early)
957
+ - Results / Findings → medium
958
+ - Discussion → medium
959
+ - Introduction → low (easier to write once you know what you're introducing)
960
+ - Conclusion → low (summary of everything else)
961
+
962
+ ## Step 7: Validate and Summarize
963
+
964
+ 1. Run \`research_model_validate\` to check for issues
965
+ 2. Present a summary:
966
+ - Paper title and scope
967
+ - Research questions
968
+ - Section outline with purposes
969
+ - Source mapping (if any)
970
+ - Work items created
971
+ - Any warnings from validation (unsupported claims, empty sections — expected at this stage)
972
+
973
+ ## Rules
974
+ - This is INTERACTIVE. Ask questions, propose, get feedback, iterate. Do NOT generate the entire outline in one shot.
975
+ - Respect existing model state. If sections already exist, propose modifications rather than replacing everything.
976
+ - Each section's purpose should clearly state what it argues or establishes.
977
+ - Claims are hypotheses at this stage — mark them as unsupported until sources are linked.
978
+ - Use the ask_user tool to present options when choices are needed.
979
+ - If the user says "skip" or "later", move to the next step.
980
+ - Total interaction should be 8-15 questions max.
981
+
982
+ ## Completion Criteria
983
+ ✓ Paper title and citation style are set
984
+ ✓ Research questions are defined
985
+ ✓ Section structure matches the paper scope
986
+ ✓ Each section has a clear purpose
987
+ ✓ Sources mapped to sections (if available)
988
+ ✓ Work items created for each section
989
+ ✓ Model validates without structural errors
990
+ ✓ User has reviewed and approved the outline`,
991
+ tags: ['research', 'planning', 'outline'],
992
+ });
993
+ // =============================================================================
847
994
  // Aggregate export
848
995
  // =============================================================================
849
996
  /**
850
- * All platform-specific skills (9 total).
997
+ * All platform-specific skills (10 total).
851
998
  * These skills reference platform tools (backlog, workitems, documents, projects)
852
999
  * and belong in the SDK rather than in generic agent/coding libraries.
853
1000
  */
@@ -861,4 +1008,5 @@ export const platformSkills = [
861
1008
  sessionNotesSkill,
862
1009
  buildSkill,
863
1010
  scaffoldSkill,
1011
+ outlineSkill,
864
1012
  ];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@compilr-dev/sdk",
3
- "version": "0.5.2",
3
+ "version": "0.5.4",
4
4
  "description": "Universal agent runtime for building AI-powered applications",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",