Structured Reasoning
keep_thinkingStructure multi-step debugging and planning across tool calls — not a one-shot think. Tracks hypotheses, observations, plans; detects loops via lastActions; riskLevel high/critical blocks dangerous edits (drop table, prod deploy). Loads projectBrief (stack, key_paths, project_memory recall) on local project. On close, suggestedRemember → call project_memory remember. 4 credits hosted. Hard cap 10 thoughts/session. Call when: stuck after 2+ failed debug attempts, auth/billing/schema change spans 3+ files, flaky test you cannot explain, or you need a plan before editing. Pass lastActions (2–5 recent tool calls), goalAnchor after thought 2, sessionId to resume, area for subsystem. NOT when fix is known, single typo, repeating without new evidence, or session ended (nextThoughtNeeded:false). Read thoughtConfirmed and shouldContinue first. Legacy alias: thinking. Example: keep_thinking({ thought: 'Hypothesis: refresh token not rotated in middleware', thoughtType: 'hypothesis', thoughtNumber: 1, totalThoughts: 5, nextThoughtNeeded: true, confidence: 0.6, goalAnchor: 'Fix auth logout loop', lastActions: ['find_code(query=refreshToken)', 'read_code(target=authMiddleware)'], area: 'auth' }). Read-only.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| area | No | Subsystem (auth, billing, api) — scopes project_memory recall. | |
| revises | No | Thought number this revision replaces. | |
| thought | Yes | Reasoning (20–2000 chars) — file names, symbols, error messages. | |
| sessionId | No | Resume prior session; restores checkpoint on thought 1. | |
| confidence | Yes | 0–1. Below 0.5 forces revision. Above 0.85 safe to proceed. | |
| goalAnchor | No | One sentence restating the task — required after thought 2. | |
| actionReady | No | true when done planning and about to execute edits. | |
| assumptions | No | Up to 5 assumptions; set invalidated:true when contradicted. | |
| lastActions | No | Last 2–5 tool calls as name(arg=val) — identical pair triggers boredLoopDetected. | |
| projectPath | No | Local project root (stdio defaults to cwd) for projectBrief. | |
| thoughtType | Yes | hypothesis|debug for investigation; plan|conclusion before acting. | |
| thoughtNumber | Yes | 1-based thought index in this session. | |
| totalThoughts | Yes | Estimated thoughts needed (revise upward if needed). | |
| nextThoughtNeeded | Yes | false ends session and writes checkpoint. | |
| toolOutputRelevance | No | Classify last tool result — 3+ noise/error in last 5 triggers loop. |