Skip to main content
Glama

soul_reflect

Run reflection cycles to test recent signals, discover new frameworks, or audit system coherence and redundancy.

Instructions

Trigger a reflection cycle. Quick: tests frameworks against recent signals. Deep: full analysis with framework discovery. Meta: audits framework coherence and redundancy.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
tierYesReflection tier: quick (fast, signal testing), deep (thorough, discovers new frameworks), meta (audits the system itself)

Implementation Reference

  • Main handler function for the soul_reflect tool. Takes a tier ('quick', 'deep', 'meta') and orchestrates reflection. For 'meta', runs meta-reflection directly. For 'quick'/'deep', checks signal count, runs reflection, formats results, and auto-chains meta-reflection on large changes or every 5 reflections.
    export async function handleSoulReflect(
      tier: "quick" | "deep" | "meta",
    ): Promise<string> {
      // Meta-reflection doesn't need signals — it audits framework state
      if (tier === "meta") {
        let result: ReflectionResult;
        try {
          result = await runMetaReflection();
        } catch (err) {
          return `Meta-reflection failed: ${err}`;
        }
        return formatReflectionResult(result);
      }
    
      const signalCount = await getSignalCount();
    
      if (signalCount === 0) {
        return "No signals to reflect on. Signals are collected automatically from conversations via the Stop hook, or you can report them with soul_signal().";
      }
    
      let result: ReflectionResult;
      try {
        result = await runReflection(tier);
      } catch (err) {
        return `Reflection failed: ${err}`;
      }
    
      const lines: string[] = [formatReflectionResult(result)];
    
      // Auto-chain meta-reflection on large changes or periodically
      const largeChanges = result.retired >= 2 || result.newFrameworks >= 2 || result.frameworksUpdated >= 8;
      const meta = await loadMeta();
      const periodic = meta.reflectionCount > 0 && meta.reflectionCount % 5 === 0;
    
      if (largeChanges || periodic) {
        const reason = largeChanges
          ? `large changes (${result.retired} retired, ${result.newFrameworks} new, ${result.frameworksUpdated} updated)`
          : `periodic audit (reflection #${meta.reflectionCount})`;
    
        lines.push("");
        lines.push(`Auto-chaining meta-reflection: ${reason}...`);
    
        try {
          const metaResult = await runMetaReflection();
          lines.push("");
          lines.push(formatReflectionResult(metaResult));
        } catch (metaErr) {
          lines.push(`Meta-reflection failed: ${metaErr}`);
        }
      }
    
      return lines.join("\n");
    }
  • Format helper that converts a ReflectionResult object into a human-readable markdown string, showing signals processed, frameworks updated, new frameworks, retired, lessons, exemplars, tensions, snapshot info, and insight.
    function formatReflectionResult(result: ReflectionResult): string {
      const tierLabel = result.tier.toUpperCase();
      const lines: string[] = [];
      lines.push(`## ${tierLabel} Reflection Complete`);
    
      if (result.signalsProcessed > 0) {
        lines.push(`- Signals processed: ${result.signalsProcessed}`);
      }
      if (result.frameworksUpdated > 0) {
        lines.push(`- Frameworks updated: ${result.frameworksUpdated}`);
      }
      if (result.newFrameworks > 0) {
        lines.push(`- New frameworks: ${result.newFrameworks}`);
      }
      if (result.retired > 0) {
        lines.push(`- Retired: ${result.retired}`);
      }
      if (result.lessonsGenerated > 0) {
        lines.push(`- Lessons generated: ${result.lessonsGenerated}`);
      }
      if (result.exemplarsStored > 0) {
        lines.push(`- Exemplars stored: ${result.exemplarsStored}`);
      }
      if (result.tensionsUpdated > 0) {
        lines.push(`- Tensions updated: ${result.tensionsUpdated}`);
      }
      if (result.snapshot) {
        lines.push(`- Snapshot saved (rollback available)`);
      }
      if (result.insight) {
        lines.push(`- Insight: ${result.insight}`);
      }
    
      return lines.join("\n");
    }
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the full burden. It clearly describes the three modes: quick tests frameworks against signals, deep does full analysis with discovery, meta audits coherence. This gives good insight into behavior, though it does not explicitly mention side effects or return values.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise: three short sentences, front-loaded with the primary purpose, then bullet-like details for each tier. No extraneous information, every phrase adds value.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple one-parameter tool with no nested objects, the description adequately explains the three modes and their purposes. Although it doesn't specify output or return format, the tool's action is sufficiently described given its low complexity and the absence of an output schema.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage for the only parameter (tier) is 100% with detailed enum descriptions. The description essentially repeats that information (e.g., 'Quick: tests frameworks against recent signals') without adding new meaning, meeting the baseline for high coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool triggers a reflection cycle and distinguishes three tiers (quick, deep, meta) with specific behaviors. Each tier is uniquely described, differentiating it from sibling tools like soul_read or soul_evaluate.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description explains what each tier does (quick for fast testing, deep for thorough analysis, meta for audit), which implies when to use each, but does not explicitly compare to alternatives or state when not to use this tool. No contrast with sibling tools is provided.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/DomDemetz/claude-soul'

If you have feedback or need assistance with the MCP directory API, please join our Discord server