Thoughtbox research

From Kastalien-Research/thoughtbox · View interactive version

Thoughtbox research is an AI agent skill from the GitHub repository Kastalien-Research/thoughtbox. Structured research using Thoughtbox IRCoT (Interleaved Retrieval and Chain-of-Thought). Triggers on: "research", "investigate", "explore", "literature review", "what do we know about".

How to use this skill

Skill file

Research this topic using Thoughtbox IRCoT: $ARGUMENTS

Protocol References

Phase 1: Setup

Create a Thoughtbox session and assess available tools.

// thoughtbox_execute
async () => {
  await tb.thought({
    thought: "Research question: $ARGUMENTS. Available search tools: [list from ToolSearch]. Strategy: breadth-first scan, then depth on promising leads.",
    thoughtType: "context_snapshot",
    nextThoughtNeeded: true,
    thoughtNumber: 1,
    totalThoughts: 30,
    sessionTitle: "Research: $ARGUMENTS",
    sessionTags: ["research"],
    contextData: {
      toolsAvailable: [],
      constraints: ["primary sources preferred"]
    }
  });
}

Steps:

  1. Use ToolSearch to discover available search tools (Exa, WebSearch, WebFetch, Grep, Read).
  2. Record thought 1 as context_snapshot: state the research question, available tools, constraints.
  3. If no search tools are available, note the limitation and rely on codebase/knowledge graph only.

Phase 2: IRCoT Loop (Think, Search, Integrate, Repeat)

Run this cycle until the question is answered or no productive search avenues remain.

2a: Reason

Record a reasoning thought: what do I need to find out next? What gaps remain?

// thoughtbox_execute
async () => {
  await tb.thought({
    thought: "Gap: I know X but not Y. Next search: [specific query]. Rationale: [why this fills the gap].",
    thoughtType: "reasoning",
    nextThoughtNeeded: true,
    thoughtNumber: N,
    totalThoughts: 30
  });
}

2b: Search

Use the best available tool for the current sub-question:

2c: Integrate

Record findings as a reasoning thought with evidence references. Include source URLs or file paths.

// thoughtbox_execute
async () => {
  await tb.thought({
    thought: "Finding: [what was learned]. Source: [url/path]. Confidence: [high/medium/low]. Implication: [how this changes understanding].",
    thoughtType: "reasoning",
    nextThoughtNeeded: true,
    thoughtNumber: N,
    totalThoughts: 30
  });
}

2d: Synthesis Checkpoint (every 10-15 thoughts)

Consolidate findings so far. Identify contradictions, gaps, and next priorities.

// thoughtbox_execute
async () => {
  await tb.thought({
    thought: "Synthesis at thought N: [summary of key findings]. Contradictions: [if any]. Remaining gaps: [list]. Priority for next cycle: [specific question].",
    thoughtType: "synthesis",
    nextThoughtNeeded: true,
    thoughtNumber: N,
    totalThoughts: 30
  });
}

Loop Exit Criteria

Stop the IRCoT loop when ANY of these hold:

Phase 3: Knowledge Persistence

Bridge findings into the Thoughtbox knowledge graph for future retrieval.

For each key finding:

// thoughtbox_execute
async () => {
  const entity = await tb.knowledge.createEntity({
    name: "Finding: [concise label]",
    entityType: "Insight",
    observations: [
      "[key claim]. Source: [url/path]. Confidence: [level]."
    ]
  });

  // Link related findings
  await tb.knowledge.createRelation({
    from: entity.id,
    to: relatedEntityId,
    relationType: "BUILDS_ON"
  });
}

Relation types to use:

Add observations with source attribution to every entity.

Phase 4: Delivery

4a: Conclusion

Record a final thought closing the session.

// thoughtbox_execute
async () => {
  await tb.thought({
    thought: "Conclusion: [answer to original question]. Key evidence: [top 3 sources]. Confidence: [overall level]. Open questions: [if any].",
    thoughtType: "conclusion",
    nextThoughtNeeded: false,
    thoughtNumber: N,
    totalThoughts: N
  });
}

4b: Export

Present findings to the user as structured markdown:

4c: Extract Learnings

If the session produced reusable insights, extract them.

// thoughtbox_execute
async () => {
  const analysis = await tb.session.analyze();
  if (analysis.insightDensity > 0.3) {
    await tb.session.extractLearnings();
  }
}

Anti-Patterns

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.