tunnel_state
Resume cognitive work by reconstructing thinking stages, open questions, and decisions for any domain. Returns previous context including emotional tone and concepts.
Instructions
Reconstruct cognitive save-state for a domain β where you left off.
Returns: thinking stage, open questions, decisions, concepts, emotional tone.
The 'load game' button for your mind.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| domain | Yes | ||
| limit | No |
Implementation Reference
- The 'tunnel_state' tool implementation in brain_mcp/server/tools_prosthetic.py. It reconstructs the cognitive save-state for a given domain by querying the summaries database or falling back to raw conversation data.
def tunnel_state(domain: str, limit: int = 10) -> str: """ Reconstruct cognitive save-state for a domain β where you left off. Returns: thinking stage, open questions, decisions, concepts, emotional tone. The 'load game' button for your mind. """ db = get_summaries_db() if db: rows = db.execute(""" SELECT summary, thinking_stage, importance, emotional_tone, open_questions, decisions, concepts, key_insights, connections_to, cognitive_pattern, problem_solving_approach, msg_count, title, source FROM summaries WHERE domain_primary = ? ORDER BY summarized_at DESC LIMIT ? """, [domain, limit]).fetchall() if not rows: return f"No conversations found for domain: {domain}" cols = [ "summary", "thinking_stage", "importance", "emotional_tone", "open_questions", "decisions", "concepts", "key_insights", "connections_to", "cognitive_pattern", "problem_solving_approach", "msg_count", "title", "source", ] latest = dict(zip(cols, rows[0])) all_oq, all_dec, all_concepts, all_insights, all_connections = [], [], set(), [], set() importance_counts = {"breakthrough": 0, "significant": 0, "routine": 0} stage_counts = {} for row in rows: r = dict(zip(cols, row)) for q in parse_json_field(r["open_questions"]): if q and q.lower() != "none identified" and q not in all_oq: all_oq.append(q) for d in parse_json_field(r["decisions"]): if d and d not in all_dec: all_dec.append(d) for c in parse_json_field(r["concepts"]): all_concepts.add(c) for i in parse_json_field(r["key_insights"]): if i and i not in all_insights: all_insights.append(i) for c in parse_json_field(r["connections_to"]): all_connections.add(c) imp = r["importance"] or "routine" importance_counts[imp] = importance_counts.get(imp, 0) + 1 stage = r["thinking_stage"] or "" stage_counts[stage] = stage_counts.get(stage, 0) + 1 output = [f"## π§ Tunnel State: {domain}\n"] output.append(f"**Current stage:** {latest['thinking_stage'] or 'unknown'}") output.append(f"**Emotional tone:** {latest['emotional_tone'] or 'unknown'}") output.append(f"**Conversations:** {len(rows)} (last {limit})") bt = importance_counts.get("breakthrough", 0) if bt: output.append(f"**Breakthroughs:** {bt} π") output.append(f"**Cognitive pattern:** {latest['cognitive_pattern'] or 'unknown'}") output.append(f"**Problem solving:** {latest['problem_solving_approach'] or 'unknown'}") if all_oq: output.append(f"\n### β Open Questions ({len(all_oq)})") for q in all_oq[:10]: output.append(f" - {q}") if len(all_oq) > 10: output.append(f" _... and {len(all_oq)-10} more_") if all_dec: output.append(f"\n### β Decisions ({len(all_dec)})") for d in all_dec[:7]: output.append(f" - {d}") if len(all_dec) > 7: output.append(f" _... and {len(all_dec)-7} more_") if all_concepts: output.append(f"\n### π·οΈ Active Concepts ({len(all_concepts)})") output.append(f" {', '.join(sorted(all_concepts)[:15])}") if all_insights: output.append(f"\n### π‘ Key Insights") for i in all_insights[:5]: output.append(f" - {i}") if all_connections: output.append(f"\n### π Connected Domains") output.append(f" {', '.join(sorted(all_connections)[:10])}") if stage_counts: output.append(f"\n### π Thinking Stage History") for s, c in sorted(stage_counts.items(), key=lambda x: -x[1]): output.append(f" {s or 'unknown'}: {c}") return "\n".join(output)