OMNISKILL v3.0 โ Sequential Thinking Guide
Overview
Sequential thinking is a structured reasoning protocol that forces agents to show their work before producing output. It prevents premature conclusions, missed edge cases, and shallow analysis by requiring explicit reasoning phases.
The 4 Phases
Every non-trivial reasoning task passes through four phases in strict order:
View original ASCII
DECOMPOSE โ REASON โ VALIDATE โ SYNTHESIZEPhase 1: DECOMPOSE
Break the problem into atomic sub-problems. No reasoning yet โ only structure.
[THINKING]
PHASE: DECOMPOSE
The user wants authentication for a REST API.
Sub-problems:
1. Authentication method selection (JWT vs session vs OAuth)
2. Token storage strategy (httpOnly cookie vs localStorage)
3. Password hashing algorithm selection
4. Session expiry and refresh logic
5. Route protection middleware
6. Error responses for auth failures
[/THINKING]
Rules: - Each sub-problem must be independently addressable - No sub-problem should contain hidden assumptions - List at least 3 sub-problems (if fewer, the task may not need sequential thinking)
Phase 2: REASON
Address each sub-problem with explicit reasoning. State trade-offs, not just conclusions.
View original ASCII
[THINKING]
PHASE: REASON
1. Authentication method:
- JWT: Stateless, scalable, but revocation is complex
- Session: Server-side state, simpler revocation, but requires session store
- Spec says "server-side sessions" โ session-based auth (no choice to make)
2. Token storage:
- httpOnly cookie: XSS-resistant, automatic sending
- localStorage: Vulnerable to XSS, manual header management
โ httpOnly cookie (spec doesn't specify, defaulting to more secure option)
3. Password hashing:
- bcrypt: Well-tested, configurable rounds, widely supported
- argon2: Memory-hard, newer, better against GPU attacks
โ bcrypt with cost factor 12 (spec doesn't specify, using industry default)
[/THINKING]Rules: - Every sub-problem from DECOMPOSE must be addressed - Trade-offs must be stated, not just the chosen option - If the spec dictates the answer, cite the spec section
Phase 3: VALIDATE
Check reasoning against constraints, edge cases, and the original problem statement.
[THINKING]
PHASE: VALIDATE
Checking against spec requirements:
โ Server-side sessions โ addressed in sub-problem 1
โ HTTPS required โ not yet addressed, adding to implementation
โ Rate limiting on login โ missed this, adding sub-problem
Edge cases:
- What if session store goes down? โ Need fallback/error handling
- Concurrent sessions from same user? โ Spec says "single session only"
- Session fixation attacks? โ Regenerate session ID on login
Contradictions found: None
Missing requirements found: Rate limiting, HTTPS enforcement
[/THINKING]
Rules: - Every spec requirement must have a โ or โ check - At least 3 edge cases must be considered - Any โ items must be resolved before SYNTHESIZE
Phase 4: SYNTHESIZE
Combine validated reasoning into a coherent plan or output. This is the only phase that produces user-facing content.
[THINKING]
PHASE: SYNTHESIZE
Implementation plan:
1. Session-based auth with express-session + Redis store
2. httpOnly cookies for session ID transport
3. bcrypt (cost 12) for password hashing
4. Session regeneration on login (fixation prevention)
5. Single-session enforcement (invalidate previous on new login)
6. Rate limiting: 5 attempts per 15 minutes per IP
7. HTTPS enforcement via middleware
8. Error responses: 401 (unauthenticated), 403 (unauthorized)
[/THINKING]
[THINKING] Block Format
All reasoning is wrapped in [THINKING]...[/THINKING] blocks. These blocks:
- Are required for any task rated complexity โฅ 3 (see metacognition scaling)
- Are captured as part of the thinking trace artifact
- Are auditable โ reviewers can inspect the reasoning chain
- Are not shown to end users unless they request the trace
Format Rules
[THINKING]
PHASE: <DECOMPOSE|REASON|VALIDATE|SYNTHESIZE>
<structured reasoning content>
[/THINKING]
- One
[THINKING]block per phase (4 blocks total for a full trace) - Phases must appear in order โ no skipping, no reordering
- Content inside blocks uses plain text and markdown lists
- No code execution inside thinking blocks โ reasoning only
Thinking Trace Schema
File: schemas/thinking-trace.schema.yaml
Thinking traces are persisted as structured artifacts for audit and debugging.
type: object
required: [task_id, agent, phases, timestamp]
properties:
task_id:
type: string
description: Unique identifier for the task
agent:
type: string
description: Agent that produced the trace
timestamp:
type: string
format: date-time
phases:
type: object
required: [decompose, reason, validate, synthesize]
properties:
decompose:
type: object
required: [sub_problems]
properties:
sub_problems:
type: array
items:
type: string
minItems: 1
reason:
type: object
required: [analysis]
properties:
analysis:
type: array
items:
type: object
required: [sub_problem, reasoning, decision]
properties:
sub_problem:
type: string
reasoning:
type: string
decision:
type: string
trade_offs:
type: array
items:
type: string
validate:
type: object
required: [spec_checks, edge_cases]
properties:
spec_checks:
type: array
items:
type: object
required: [requirement, status]
properties:
requirement:
type: string
status:
type: string
enum: [pass, fail, partial]
edge_cases:
type: array
items:
type: object
required: [case, mitigation]
properties:
case:
type: string
mitigation:
type: string
contradictions:
type: array
items:
type: string
synthesize:
type: object
required: [plan]
properties:
plan:
type: array
items:
type: string
metadata:
type: object
properties:
complexity:
type: integer
minimum: 1
maximum: 10
duration_ms:
type: integer
token_count:
type: integer
BrowseComp Reasoning Pattern
For research-heavy tasks (codebase exploration, competitive analysis, information gathering), use the BrowseComp pattern instead of the standard 4-phase approach:
DETECT โ HYPOTHESIZE โ ENUMERATE โ VERIFY โ CONTINUE
DETECT
Identify what information is needed and what is currently unknown.
[THINKING]
PHASE: DETECT
Need: How does the auth middleware work in this codebase?
Known: Express.js project, has middleware/ directory
Unknown: Which middleware handles auth, how sessions are managed
[/THINKING]
HYPOTHESIZE
Form hypotheses about where the answer lives and what it looks like.
[THINKING]
PHASE: HYPOTHESIZE
H1: Auth middleware is in middleware/auth.js
H2: Session config is in config/session.js or app.js
H3: Passport.js is used (common in Express projects)
[/THINKING]
ENUMERATE
List all sources to check and check them systematically.
[THINKING]
PHASE: ENUMERATE
Sources to check:
1. middleware/*.js โ grep for "auth", "session", "passport"
2. package.json โ check for passport, express-session deps
3. app.js โ check middleware registration order
4. routes/*.js โ check how auth is applied to routes
[/THINKING]
VERIFY
Confirm or reject each hypothesis with evidence.
CONTINUE
If questions remain, loop back to DETECT with updated knowledge. Stop when all unknowns are resolved.
Complexity Scaling
The metacognition synapse (synapses/metacognition.md) determines how much thinking is required based on task complexity:
| Complexity | Thinking Required | Example |
|---|---|---|
| 1-2 | None โ direct response | "What's the project name?" |
| 3-4 | Lightweight โ DECOMPOSE + SYNTHESIZE only | "Add a new API endpoint" |
| 5-6 | Standard โ all 4 phases | "Implement auth system" |
| 7-8 | Deep โ 4 phases + BrowseComp for research | "Design microservice architecture" |
| 9-10 | Exhaustive โ 4 phases + multiple iterations | "Full-stack product from scratch" |
Complexity Assessment
The agent self-assesses complexity at the start of each task:
[THINKING]
PHASE: COMPLEXITY_ASSESSMENT
Task: "Add pagination to the users endpoint"
Factors:
- Scope: Single endpoint modification (low)
- Ambiguity: Clear requirement (low)
- Dependencies: Database query changes, response format (medium)
- Risk: Could break existing clients (medium)
Assessment: Complexity 4 โ Lightweight thinking (DECOMPOSE + SYNTHESIZE)
[/THINKING]
Pipeline Integration
Thinking traces are first-class artifacts in the pipeline system.
Traces as Audit Artifacts
Every pipeline step produces a thinking trace alongside its primary artifact. These traces are:
- Stored in the pipeline state file under
thinking_traces[] - Validated by
post_step.pyโ missing traces for complexity โฅ 3 tasks cause validation failure - Available to downstream agents โ the context-curator can include relevant traces in handoffs
- Reviewable โ the reviewer agent checks traces for reasoning quality
Example: Trace in Pipeline State
{
"pipeline_id": "sdd-abc123",
"step": "implement-auth",
"thinking_trace": {
"task_id": "impl-auth-001",
"agent": "implementer",
"phases": {
"decompose": { "sub_problems": ["..."] },
"reason": { "analysis": ["..."] },
"validate": { "spec_checks": ["..."], "edge_cases": ["..."] },
"synthesize": { "plan": ["..."] }
},
"metadata": {
"complexity": 6,
"duration_ms": 4500
}
}
}
Reviewer Trace Inspection
The reviewer agent checks thinking traces as part of its compliance review:
- Completeness: All 4 phases present for tasks rated โฅ 5
- Spec alignment: Every spec requirement appears in the VALIDATE phase
- Reasoning quality: REASON phase shows trade-offs, not just conclusions
- Edge coverage: VALIDATE phase lists โฅ 3 edge cases for tasks rated โฅ 5
Traces with gaps are flagged as INCOMPLETE_REASONING in the review report.