AbstractionLadderTask

Traverse abstraction levels to identify patterns, generalizations, and architectural insights from your code or concepts.

Category: Reasoning Side-Effect: Safe Model: GPT-4 Preferred
⚙️ TaskConfig.json
{
  "concrete_concept": "File-based logging",
  "direction": "both",
  "levels": 3,
  "identify_patterns": true,
  "input_files": ["src/Logger.kt"]
}
👁️ SessionTask UI
Overview
Upward Analysis
Downward Analysis
Pattern Analysis
### Level 1: Data Persistence Sink

Generalization: Abstracting the destination of log entries.
Patterns: Strategy Pattern, Observer Pattern.
Refactoring: Introduce LogAppender interface to decouple from File IO.

✔ Upward analysis complete

Test Workspace Browser

Explore the artifacts generated during the analysis of the test workspace, including the detailed markdown reports and transcripts.

Configuration Parameters

Field Type Description
concrete_concept * String The concrete concept, problem, or code pattern to analyze.
direction String Direction to traverse: 'up' (abstraction), 'down' (concretization), or 'both'. Default: both.
levels Int Number of abstraction levels to traverse in each direction (1-5). Default: 3.
identify_patterns Boolean Whether to identify design patterns, anti-patterns, and refactoring opportunities. Default: true.
input_files List<String> Specific files or patterns (e.g. **/*.kt) to be used as input for the task.
related_files List<String> Additional files for context (e.g., existing code, related implementations).

Task Lifecycle

  1. Initialization: Validates concrete_concept, direction, and levels (1-5).
  2. Context Gathering: Reads input_files and related_files to provide concrete code context.
  3. Upward Analysis: (If 'up' or 'both') Identifies generalizations, architectural patterns, and refactoring opportunities.
  4. Downward Analysis: (If 'down' or 'both') Identifies specific implementations, idioms, and code smells.
  5. Pattern Synthesis: (If enabled) Generates a comprehensive report with design patterns, insights, and actionable recommendations.

Error Handling

The task performs strict validation on the direction and levels parameters, failing early with a descriptive error if the configuration is invalid.

Embedded Invocation (Kotlin)

Use the UnifiedHarness to run this task programmatically in a headless environment.


import com.simiacryptus.cognotik.plan.tools.reasoning.AbstractionLadderTask.Companion.AbstractionLadder
import com.simiacryptus.cognotik.plan.tools.reasoning.AbstractionLadderTask.AbstractionLadderTaskExecutionConfigData
import com.simiacryptus.cognotik.plan.tools.TaskTypeConfig

// 1. Define the execution parameters
val executionConfig = AbstractionLadderTaskExecutionConfigData(
    concrete_concept = "Authentication Middleware",
    direction = "both",
    levels = 3,
    identify_patterns = true,
    input_files = listOf("src/auth/*.kt")
)
// 2. Run via the harness
harness.runTask(
    taskType = AbstractionLadder,
    typeConfig = TaskTypeConfig(name = "AuthAnalysis"),
    executionConfig = executionConfig,
    workspace = File("./my-project"),
    autoFix = true
)
            

CLI / JSON Configuration


{
  "task_type": "AbstractionLadder",
  "concrete_concept": "Event-driven architecture",
  "direction": "up",
  "levels": 4
}
            

Prompt Segment

This task injects the following logic into the LLM context:


AbstractionLadder - Traverse abstraction levels to find patterns and design insights
  ** Specify the concrete concept or problem to analyze
  ** Choose direction: 'up' (generalize), 'down' (concretize), or 'both'
  ** Set number of levels to traverse (1-5 recommended)
  ** Enable pattern identification to discover:
     - Design patterns and anti-patterns
     - Refactoring opportunities
     - Architectural insights
     - Code smells and improvements
  ** Related files provide context for analysis
  ** Output includes: Abstraction hierarchy, pattern analysis, and recommendations