pageel/para-workspace/deep-reasoning
Claude Code and agent skill by pageel/para-workspace
- community
Checking that the SKILL.md file is still in the repository.
Structured Chain-of-Thought (CoT) & Deep Reasoning Protocol for complex problem analysis, architectural decisions, security evaluations, and deep troubleshooting. Activate when `--deep` or `--cot` flag is present in workflows, or when deep architectural reasoning is required. Supports MCP Graph integration for codebase-grounded reasoning. v2.2.0: Adaptive Budget, Tier Detection, Phase Reentry, Audit Logging, Process Transparency Harness Guard.
Install
npx vskill@latest install pageel/para-workspace/deep-reasoningSKILL.md
Deep Reasoning Protocol (CoT Engine)
Purpose: Provide a structured, repeatable 4-phase Chain-of-Thought (CoT) reasoning protocol for high-complexity tasks, cross-cutting architectural choices, security audits, and root-cause debugging.Trigger:- Explicitly activated via--deepor--cotflags in workflows (e.g.,/brainstorm,/sysdesign,/fix,/spec,/plan).- Automatically loaded when analyzing multi-system architecture, breaking changes, complex migrations, or security vulnerabilities.
Process Transparency Harness Guard (v2.2.0)
Origin: Q9 — Discovered when Flash 3.6 Medium executed Tier Detection correctly but skipped artifact creation.Severity: 🔴 Mandatory — applies to ALL models executing this skill.
Guard 1: Artifact Creation Enforcement
When this skill is activated inside a workflow that creates artifacts (e.g., /brainstorm, /sysdesign, /fix):
- Agent MUST create or append to the workflow's artifact file BEFORE entering Phase 1.
- Agent MUST NOT run the 4-phase cycle in
<thought>only — the process MUST be visible in the artifact. - If the calling workflow has no artifact mechanism, Agent MUST output phases directly in the chat response.
Guard 2: Phase Skip Detection
Agent MUST execute ALL phases (Step 0, Phase 1, Phase 2, Phase 3, Phase 4). If any phase is skipped:
This warning MUST appear in the output (artifact or chat). Agent MUST NOT silently skip phases.
Valid skip reasons (exhaustive list):
user-requested— User explicitly asked to skipempty-graph-downgrade— Graph exists but returned empty results (Phase 2-3 MCP skip)time-budget-exceeded— Context window approaching limit
Any other reason is a protocol violation.
Guard 3: Phase Logging in Artifacts
When writing to an artifact file, each phase MUST have its own section header:
Rationale: Users MUST be able to trace the full reasoning process by reading the artifact file alone, without needing access to the Agent's internal<thought>chain.
Step 0: Complexity Tier Detection (Pre-Cycle)
Timing: BEFORE the 4-phase reasoning cycle. Agent MUST determine the complexity tier to allocate the correct MCP budget.Gate: Run Step 0 FIRST, then enter Phase 1 with the allocated budget.
Hybrid 3-Layer Detection Algorithm
Layer 1: Prompt Keyword Signals (40% weight, zero-cost)
| Signal | Tier Hint | Regex Examples | ||||
|---|---|---|---|---|---|---|
| Single entity focus | Tier 1 | "tối ưu function X", "fix bug trong module Y" | ||||
| Cross-module mention | Tier 2 | `/tích hợp\ | integration\ | refactor.*module\ | cross.*module/i` | |
| Architecture/trade-off | Tier 3 | `/redesign\ | migration\ | architect\ | cross-cutting/i` | |
| Compare N≥3 options | Tier 3 | `/so sánh.*(3\ | 4\ | 5\ | nhiều).*option/i` |
Layer 2: Graph Stats (40% weight, 1 scout MCP call, only when `--graph`)
Scout call: graph_god_nodes(topN=3) → extract totalNodes, topGodEdges
| Metric | Tier 1 | Tier 2 | Tier 3 | Bonus | |
|---|---|---|---|---|---|
| Total nodes | ≤ 50 (+1) | 51-200 (+2) | > 200 (+3) | — | |
| Top god node edges | — | — | — | > 40 (+1) |
No graph available? → Prompt score × 1.5, cap at Tier 2.
Layer 3: Agent Override (20% weight)
- Agent MAY upgrade/downgrade 1 level, MUST justify in CoT Summary
- CANNOT downgrade if prompt contains tier3 keywords
Score Mapping:
| Score | Tier | MCP Budget | Phase Budget Breakdown | |
|---|---|---|---|---|
| 1-3 | Tier 1 | 9 calls | P1: 2, P2: 3, P3: 2, P4: 2 | |
| 4-5 | Tier 2 | 14 calls | P1: 3, P2: 5, P3: 3, P4: 3 | |
| 6+ | Tier 3 | 21 + 3 reentry | P1: 4, P2: 8, P3: 5, P4: 4 (+3 reentry) |
Mid-Session Escalation: If Phase 2 impact_analysis > 20 affected nodes AND Tier == 1 → upgrade Tier 1→2. Max 1 escalation per session.
Scout Call Budget Note: The Layer 2 scout call (graph_god_nodes) counts as 1 call from the Phase 1 budget. If no graph exists, the scout call is skipped and the budget is unchanged.
Reasoning Workflow (4-Phase Cycle)
When this skill is active, the Agent MUST execute the following 4 phases inside its internal reasoning process (<thought>) before outputting final proposals or writing artifacts.
Graph-Enhanced CoT (MCP Integration)
Gate: Before starting the 4-phase cycle, Agent MUST check if the active project has a code-knowledge graph:```bashtest -d "Projects/[project-name]/.beads/graph" || test -d "Projects/[project-name]/repo/.beads/graph"```- IF graph exists → Agent MUST use MCP tools to ground each reasoning phase in real codebase data (see per-phase MCP table below). This prevents hallucinated architectural assumptions.- IF no graph → Agent runs the protocol as pure reasoning. No MCP calls.
Adaptive MCP Budget Allocation (Per Tier)
Budget Rule: Agent MUST track MCP call count per phase. When phase budget is exhausted, move to next phase. Auditmemory_pushcalls (kind:cot-audit) are system overhead and do NOT count against the tier budget.
Tier 1 — Simple (9 calls total)
| Phase | Budget | Priority Tools | |
|---|---|---|---|
| Phase 1 (Decompose) | 2 | graph_query, memory_search | |
| Phase 2 (Diverge) | 3 | graph_impact_analysis, graph_god_nodes | |
| Phase 3 (Red-Team) | 2 | graph_edges, insight_search | |
| Phase 4 (Converge) | 2 | memory_push (cot-decision), optional |
Tier 2 — Moderate (14 calls total)
| Phase | Budget | Priority Tools | |
|---|---|---|---|
| Phase 1 (Decompose) | 3 | graph_query, memory_search, graph_context_bundle | |
| Phase 2 (Diverge) | 5 | graph_impact_analysis ×2, graph_god_nodes, graph_context_bundle ×2 | |
| Phase 3 (Red-Team) | 3 | graph_edges ×2, insight_search | |
| Phase 4 (Converge) | 3 | memory_push (cot-decision), graph_enrich, optional |
Tier 3 — Complex (21 + 3 reentry calls)
| Phase | Budget | Priority Tools | |
|---|---|---|---|
| Phase 1 (Decompose) | 4 | graph_query ×2, memory_search, graph_context_bundle | |
| Phase 2 (Diverge) | 8 | graph_impact_analysis ×3, graph_god_nodes, graph_context_bundle ×2, graph_edges ×2 | |
| Phase 3 (Red-Team) | 5 | graph_edges ×2, insight_search ×2, graph_impact_analysis | |
| Phase 4 (Converge) | 4 | memory_push (cot-decision), graph_enrich ×2, insight_push | |
| Reentry (Phase 3→2) | 3 | graph_impact_analysis, graph_context_bundle, insight_search |
Early Exit: Stop divergent exploration as soon as one approach scores ≥ 0.8 higher weighted score than others. Remaining budget is NOT carried forward.
Phase 1: Problem Decomposition & Invariants
- Root Problem Formulation:
- What is the core problem behind the user request? (Separate symptoms from underlying causes).
- What domain boundaries and systems are touched?
- Invariants & Safety Guards Check:
- List workspace invariants (Kernel rules, governance, project rules) that MUST NOT be broken.
- Verify data safety, security parameters, and non-negotiable constraints.
- Implicit Assumptions Audit:
- Identify unstated assumptions in the request or environment.
- Mark assumptions that require empirical verification via tools (
view_file,grep_search). - IF graph available: Use
graph_queryto locate architectural nodes related to the problem domain. Usememory_searchto surface past decisions and friction on similar topics — avoid repeating solved problems.
Phase 2: Divergent Exploration & Multi-Perspective Scoring
- Generate 3+ Distinct Approaches:
- Approach A (Conservative): Minimal change, lowest blast radius, leverages existing patterns.
- Approach B (Balanced/Optimal): Balanced structural improvement, maintainable long-term.
- Approach C (Aggressive/Redesign): Comprehensive refactor, decouples dependencies, maximum scalability.
- Multi-Dimensional Scoring Matrix:
Score each approach on a scale of 1-5 across core engineering dimensions:
| Dimension | Weight | Approach A (Conservative) | Approach B (Balanced) | Approach C (Aggressive) | |
|---|---|---|---|---|---|
| Blast Radius & Safety (Lower risk = higher score) | 30% | [1-5] | [1-5] | [1-5] | |
| Architectural Quality & Maintainability | 25% | [1-5] | [1-5] | [1-5] | |
| Security & Failure Resilience | 20% | [1-5] | [1-5] | [1-5] | |
| Reversibility / Door Type (Two-Way = 5, One-Way = 2) | 15% | [1-5] | [1-5] | [1-5] | |
| Token & Runtime Efficiency | 10% | [1-5] | [1-5] | [1-5] | |
| Weighted Total | 100% | [Score] | [Score] | [Score] |
- Token Overhead Guard & Reasoning Scope Limits:
- Limit: Keep internal reasoning inside
<thought>under 300 lines (approx. 1,500 tokens). - Exit Criteria: Stop divergent exploration as soon as one approach scores ≥ 0.8 higher weighted score than others.
Phase 3: Red-Teaming & Stress Testing
- Failure Mode Analysis:
- How will this solution break under 10x scale, high concurrency, or network failures?
- What happens if an external dependency times out or returns unexpected state?
- Edge Cases & Race Conditions:
- Null/Empty states, malformed input, missing config, authorization boundary bypasses.
- Trade-Off Matrix Construction:
- Explicitly articulate what is being sacrificed for what (e.g., "Trading short-term dev speed for long-term schema safety").
Phase 4: Convergence & Decision Synthesis
- Selection Rationale:
- Select the single optimal approach based on Phase 2 scoring and Phase 3 stress testing.
- Justify why discarded alternatives were rejected.
- Execution Steps & Verification Plan:
- Break down the winning approach into atomic, verifiable implementation tasks.
- Define exact verification criteria (unit tests, static checks, manual inspection).
- Memory Persistence (IF graph available):
Push the CoT decision into the knowledge graph via MCP memory_push:
- kind:
cot-decision - content: Root Problem + Selected Approach (A/B/C) + 5D Weighted Score + Critical Trade-Offs
- sessionId: Current session identifier
- metadata:
{ "cotDepth": 4, "scoringDimensions": 5, "selectedApproach": "[A/B/C]", "weightedScore": [N.NN], "doorType": "[one-way/two-way]", "mcp_evidence": [true/false] }
> This enables future sessions to retrieve architectural reasoning via memory_search(query, category: "cot-decision").
- Structured CoT Artifact Section:
Format key insights to present to the user or append to the target document (brainstorm, sysdesign, research).
Phase Reentry Protocol
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingtemplates/common/agents/skills/deep-reasoning/SKILL.md
Popularity
- Repository stars
- 48
- Repository forks
- 17
- 7-day trend score
- 19
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/pageel/para-workspace/deep-reasoning)