Skip to content

RE-ARCHITECT the Simard Agent Base Type system to match the original spec. ORIGINAL SPEC SAYS: "Agent Base Type - of which there can be several, one of which is RustyClawd, but others could be based  #129

Description

@rysweet

Task Description

RE-ARCHITECT the Simard Agent Base Type system to match the original spec.

ORIGINAL SPEC SAYS:
"Agent Base Type - of which there can be several, one of which is RustyClawd, but others could be based on the Microsoft Agent Framework, the Github Copilot SDK, the Claude Code SDK, or the amplihack/amplihack-rs Goal-Seeking Agent and its OODA loop. Each of these should have a rust wrapper around it."

"a bespoke agent, built on top of rustyclawd, using the rust amplihack-memory-lib"

"I want her to be launching amplihack in a virtual tty or terminal and using it interactively, by typing commands to launch it and then reading the screen and typing prompts interactively"

WHAT IS WRONG NOW:
The current base_types.rs has LocalProcessHarnessAdapter and RustyClawdAdapter that are generic process spawners - they pipe stdin/stdout to sh or rustyclawd. This is WRONG. A Base Type is a full agent runtime that Simard delegates work to. RustyClawd is an agent that can use tools, manage conversations, call LLMs. Simard should use it AS AN AGENT, not as a subprocess to pipe text to.

WHAT MUST BE BUILT:

  1. Keep the BaseTypeFactory/BaseTypeSession trait pair - the shape is right.
  2. Replace LocalProcessHarnessAdapter with NOTHING - it was a test stub. Remove it.
  3. Replace the fake RustyClawdAdapter with a REAL one that:
    • Uses rustyclawd as a crate dependency (path = ../rustyclawd/crates/core and ../rustyclawd/crates/tools)
    • Wraps rustyclawd's agent runtime to actually process objectives through its tool-calling, LLM-calling pipeline
    • Launches rustyclawd sessions properly using its SDK
  4. Add CopilotSdkBaseType - wraps GitHub Copilot SDK (can be a stub that launches amplihack copilot via process for now, but the ARCHITECTURE must be right - it's an agent runtime, not a pipe)
  5. Add ClaudeAgentSdkBaseType - wraps Claude Agent SDK (structure only for now)
  6. Add MsAgentFrameworkBaseType - wraps Microsoft Agent Framework (structure only for now)
  7. Each base type gets its own file: src/base_type_rustyclawd.rs, src/base_type_copilot.rs, etc.
  8. base_types.rs keeps only the traits, enums, and shared types.

ALSO FIX:

  • amplihack-memory-lib integration is partially done (CognitiveMemoryStore exists in memory.rs). Verify it works and is wired into bootstrap.rs properly with the cognitive backend.
  • Cross-validate ALL modules against the full original spec.
  • The identity system (identity.rs) should support all 4+ base types in its manifests.

REPO: /home/azureuser/src/Simard (branch feat/remove-all-stubs)
RUSTYCLAWD: /home/azureuser/src/rustyclawd (workspace with crates/core, crates/tools, crates/memory, crates/cli)
AMPLIHACK-MEMORY-LIB: /home/azureuser/src/amplihack-memory-lib/rust/amplihack-memory (already a dep in Cargo.toml)

MUST: Follow all workflow steps. Use quality-audit and merge-ready before merging. Zero stubs when done.

Requirements

✅ Copied bin
✅ Copied agents/amplihack
✅ Copied commands/amplihack
🔐 Set execute permissions on 42 hook files
✅ Copied tools/amplihack
🔐 Set execute permissions on 5 hook files
✅ Copied tools/xpia
✅ Copied context
✅ Copied workflow
✅ Copied skills
✅ Copied templates
✅ Copied scenarios
✅ Copied docs
✅ Copied schemas
✅ Copied config
✅ Copied tools/statusline.sh
✅ Copied AMPLIHACK.md
✅ CLAUDE.md is current version
💾 Backup created at /home/azureuser/.claude/settings.json.backup.1774996088
📋 Found existing settings.json
🔒 XPIA security hooks directory found
🔒 XPIA security hooks configured (3 hooks)
✅ Settings updated (10 hooks configured)
✓ Rust recipe runner available
✓ Runtime directories ensured in /home/azureuser/src/Simard/worktrees/feat/issue-127-fix-all-3-critical-gaps-in-the-simard-stub-removal/.claude/runtime
Using native binary: claude at /home/azureuser/.local/bin/claude
Version: 2.1.87
Launching Claude with command: /home/azureuser/.local/bin/claude --dangerously-skip-permissions --model opus[1m] --plugin-dir /home/azureuser/.amplihack/.claude -p # Step 2c: Resolve Any Remaining Ambiguity

Task: RE-ARCHITECT the Simard Agent Base Type system to match the original spec.

ORIGINAL SPEC SAYS:
"Agent Base Type - of which there can be several, one of which is RustyClawd, but others could be based on the Microsoft Agent Framework, the Github Copilot SDK, the Claude Code SDK, or the amplihack/amplihack-rs Goal-Seeking Agent and its OODA loop. Each of these should have a rust wrapper around it."

"a bespoke agent, built on top of rustyclawd, using the rust amplihack-memory-lib"

"I want her to be launching amplihack in a virtual tty or terminal and using it interactively, by typing commands to launch it and then reading the screen and typing prompts interactively"

WHAT IS WRONG NOW:
The current base_types.rs has LocalProcessHarnessAdapter and RustyClawdAdapter that are generic process spawners - they pipe stdin/stdout to sh or rustyclawd. This is WRONG. A Base Type is a full agent runtime that Simard delegates work to. RustyClawd is an agent that can use tools, manage conversations, call LLMs. Simard should use it AS AN AGENT, not as a subprocess to pipe text to.

WHAT MUST BE BUILT:

  1. Keep the BaseTypeFactory/BaseTypeSession trait pair - the shape is right.
  2. Replace LocalProcessHarnessAdapter with NOTHING - it was a test stub. Remove it.
  3. Replace the fake RustyClawdAdapter with a REAL one that:
    • Uses rustyclawd as a crate dependency (path = ../rustyclawd/crates/core and ../rustyclawd/crates/tools)
    • Wraps rustyclawd's agent runtime to actually process objectives through its tool-calling, LLM-calling pipeline
    • Launches rustyclawd sessions properly using its SDK
  4. Add CopilotSdkBaseType - wraps GitHub Copilot SDK (can be a stub that launches amplihack copilot via process for now, but the ARCHITECTURE must be right - it's an agent runtime, not a pipe)
  5. Add ClaudeAgentSdkBaseType - wraps Claude Agent SDK (structure only for now)
  6. Add MsAgentFrameworkBaseType - wraps Microsoft Agent Framework (structure only for now)
  7. Each base type gets its own file: src/base_type_rustyclawd.rs, src/base_type_copilot.rs, etc.
  8. base_types.rs keeps only the traits, enums, and shared types.

ALSO FIX:

  • amplihack-memory-lib integration is partially done (CognitiveMemoryStore exists in memory.rs). Verify it works and is wired into bootstrap.rs properly with the cognitive backend.
  • Cross-validate ALL modules against the full original spec.
  • The identity system (identity.rs) should support all 4+ base types in its manifests.

REPO: /home/azureuser/src/Simard (branch feat/remove-all-stubs)
RUSTYCLAWD: /home/azureuser/src/rustyclawd (workspace with crates/core, crates/tools, crates/memory, crates/cli)
AMPLIHACK-MEMORY-LIB: /home/azureuser/src/amplihack-memory-lib/rust/amplihack-memory (already a dep in Cargo.toml)

MUST: Follow all workflow steps. Use quality-audit and merge-ready before merging. Zero stubs when done.
Clarified Requirements: {"acceptance_criteria":["how to verify completion"],"assumptions":["assumptions being made"],"classification":"feature/bugfix/refactor/other","estimated_complexity":"low/medium/high","explicit_requirements":["list of must-have features"],"out_of_scope":["what this does NOT include"],"questions_resolved":["clarifications made autonomously"],"task_summary":"one-line clear summary"}
Codebase Analysis: ✅ Copied bin
✅ Copied agents/amplihack
✅ Copied commands/amplihack
🔐 Set execute permissions on 42 hook files
✅ Copied tools/amplihack
🔐 Set execute permissions on 5 hook files
✅ Copied tools/xpia
✅ Copied context
✅ Copied workflow
✅ Copied skills
✅ Copied templates
✅ Copied scenarios
✅ Copied docs
✅ Copied schemas
✅ Copied config
✅ Copied tools/statusline.sh
✅ Copied AMPLIHACK.md
✅ CLAUDE.md is current version
💾 Backup created at /home/azureuser/.claude/settings.json.backup.1774995935
📋 Found existing settings.json
🔒 XPIA security hooks directory found
🔒 XPIA security hooks configured (3 hooks)
✅ Settings updated (10 hooks configured)
✓ Rust recipe runner available
✓ Runtime directories ensured in /home/azureuser/src/Simard/worktrees/feat/issue-127-fix-all-3-critical-gaps-in-the-simard-stub-removal/.claude/runtime
Using native binary: claude at /home/azureuser/.local/bin/claude
Version: 2.1.87
Launching Claude with command: /home/azureuser/.local/bin/claude --dangerously-skip-permissions --model opus[1m] --plugin-dir /home/azureuser/.amplihack/.claude -p # Step 2b: Analyze Existing Codebase Context

Task: RE-ARCHITECT the Simard Agent Base Type system to match the original spec.

ORIGINAL SPEC SAYS:
"Agent Base Type - of which there can be several, one of which is RustyClawd, but others could be based on the Microsoft Agent Framework, the Github Copilot SDK, the Claude Code SDK, or the amplihack/amplihack-rs Goal-Seeking Agent and its OODA loop. Each of these should have a rust wrapper around it."

"a bespoke agent, built on top of rustyclawd, using the rust amplihack-memory-lib"

"I want her to be launching amplihack in a virtual tty or terminal and using it interactively, by typing commands to launch it and then reading the screen and typing prompts interactively"

WHAT IS WRONG NOW:
The current base_types.rs has LocalProcessHarnessAdapter and RustyClawdAdapter that are generic process spawners - they pipe stdin/stdout to sh or rustyclawd. This is WRONG. A Base Type is a full agent runtime that Simard delegates work to. RustyClawd is an agent that can use tools, manage conversations, call LLMs. Simard should use it AS AN AGENT, not as a subprocess to pipe text to.

WHAT MUST BE BUILT:

  1. Keep the BaseTypeFactory/BaseTypeSession trait pair - the shape is right.
  2. Replace LocalProcessHarnessAdapter with NOTHING - it was a test stub. Remove it.
  3. Replace the fake RustyClawdAdapter with a REAL one that:
    • Uses rustyclawd as a crate dependency (path = ../rustyclawd/crates/core and ../rustyclawd/crates/tools)
    • Wraps rustyclawd's agent runtime to actually process objectives through its tool-calling, LLM-calling pipeline
    • Launches rustyclawd sessions properly using its SDK
  4. Add CopilotSdkBaseType - wraps GitHub Copilot SDK (can be a stub that launches amplihack copilot via process for now, but the ARCHITECTURE must be right - it's an agent runtime, not a pipe)
  5. Add ClaudeAgentSdkBaseType - wraps Claude Agent SDK (structure only for now)
  6. Add MsAgentFrameworkBaseType - wraps Microsoft Agent Framework (structure only for now)
  7. Each base type gets its own file: src/base_type_rustyclawd.rs, src/base_type_copilot.rs, etc.
  8. base_types.rs keeps only the traits, enums, and shared types.

ALSO FIX:

  • amplihack-memory-lib integration is partially done (CognitiveMemoryStore exists in memory.rs). Verify it works and is wired into bootstrap.rs properly with the cognitive backend.
  • Cross-validate ALL modules against the full original spec.
  • The identity system (identity.rs) should support all 4+ base types in its manifests.

REPO: /home/azureuser/src/Simard (branch feat/remove-all-stubs)
RUSTYCLAWD: /home/azureuser/src/rustyclawd (workspace with crates/core, crates/tools, crates/memory, crates/cli)
AMPLIHACK-MEMORY-LIB: /home/azureuser/src/amplihack-memory-lib/rust/amplihack-memory (already a dep in Cargo.toml)

MUST: Follow all workflow steps. Use quality-audit and merge-ready before merging. Zero stubs when done.
Clarified Requirements: {"acceptance_criteria":["how to verify completion"],"assumptions":["assumptions being made"],"classification":"feature/bugfix/refactor/other","estimated_complexity":"low/medium/high","explicit_requirements":["list of must-have features"],"out_of_scope":["what this does NOT include"],"questions_resolved":["clarifications made autonomously"],"task_summary":"one-line clear summary"}
Repository: /home/azureuser/src/Simard

IMPORTANT: Emit progress markers throughout this analysis

This step runs under a watchdog that times out if no output is seen for
60+ seconds. You MUST emit a progress line before each major exploration
phase so the recipe runner can see activity. Use this format:

## Progress: [Phase name] — [brief description]

Exploration Phases

Work through these phases in order, emitting a progress marker before each:

Phase 1 — Project structure
Print: ## Progress: Phase 1/4 — Scanning project structure
Use Glob to identify top-level layout, key config files (pyproject.toml,
package.json, Cargo.toml, etc.), and source directory organization.

Phase 2 — Relevant code paths
Print: ## Progress: Phase 2/4 — Searching for task-relevant code
Use Grep to find code related to the task: relevant class/function names,
imports, config keys, and patterns mentioned in the requirements.

Phase 3 — Dependencies and integration points
Print: ## Progress: Phase 3/4 — Analyzing dependencies and interfaces
Read key files (imports, interfaces, config) to understand how components
connect. Identify external dependencies relevant to the task.

Phase 4 — Synthesis
Print: ## Progress: Phase 4/4 — Synthesizing findings
Compile findings into a structured summary.

Output

Provide a codebase context summary covering:

  1. Relevant existing code and patterns
  2. Files that will likely need modification
  3. Dependencies and integration points
  4. Potential conflicts or considerations

Use glob and grep to explore the codebase. Avoid web searches.

IMPORTANT: Proceed autonomously. Do not ask questions. Make reasonable decisions and continue. --system-prompt ---
name: architect
version: 1.0.0
description: General architecture and design agent. Creates system specifications, breaks down complex problems into modular components, and designs module interfaces. Use for greenfield design, problem decomposition, and creating implementation specifications. For philosophy validation use philosophy-guardian, for CLI systems use amplifier-cli-architect.
role: "System architect and problem decomposition specialist"
model: inherit

Architect Agent

You are the system architect who embodies ruthless simplicity and elegant design. You create clear specifications that guide implementation.

Input Validation

@~/.amplihack/.claude/context/AGENT_INPUT_VALIDATION.md

Anti-Sycophancy Guidelines (MANDATORY)

@~/.amplihack/.claude/context/TRUST.md

Critical Behaviors:

  • Challenge flawed designs rather than agreeing to implement them
  • Point out when requirements are unclear or contradictory
  • Suggest better architectural approaches when you see them
  • Disagree with over-engineering or premature optimization
  • Be direct about what will and won't work

Development Patterns & Design Solutions

@~/.amplihack/.claude/context/PATTERNS.md

Reference proven patterns for:

  • Bricks & Studs modular design
  • Zero-BS implementation
  • API validation strategies
  • Error handling approaches
  • Testing patterns (TDD pyramid)
  • Platform-specific solutions

These patterns inform architectural decisions and code review evaluations.

Core Philosophy

  • Occam's Razor: Solutions should be as simple as possible, but no simpler
  • Trust in Emergence: Complex systems work best from simple components
  • Analysis First: Always analyze before implementing

Before Designing

MANDATORY: Read task_context.json first

# NOTE: This pseudocode represents a PROPOSED future implementation.
# task_context.json and read_task_context() are conceptual examples
# showing how complexity context could be passed between agents.
# These are NOT currently implemented features.

task_context = read_task_context()

if task_context.classification == "TRIVIAL":
    return SimpleDesign(
        change="Add X to config file",
        verification="Run build command",
        skip_architecture=True,
        reason="Trivial config change - no architecture needed"
    )

Design Proportionality:

  • TRIVIAL tasks: 2-3 sentence design ("Change X in file Y")
  • SIMPLE tasks: 1-paragraph design with bullet points
  • COMPLEX tasks: Multi-section design with diagrams

RED FLAG: If writing > 1 page of design for TRIVIAL task, STOP and re-classify.

Primary Responsibilities

1. Problem Analysis

When given any task, start with:
"Let me analyze this problem and design the solution."

Provide:

  • Problem Decomposition: Break into manageable pieces
  • Solution Options: 2-3 approaches with trade-offs
  • Recommendation: Clear choice with justification
  • Module Specifications: Clear contracts for implementation

2. System Design

Create specifications following the brick philosophy:

  • Single Responsibility: One clear purpose per module
  • Clear Contracts: Define inputs, outputs, side effects
  • Regeneratable: Can be rebuilt from spec alone
  • Self-Contained: All module code in one directory

3. Code Review

Review for:

  • Simplicity: Can it be simpler?
  • Clarity: Is the purpose obvious?
  • Modularity: Are boundaries clean?
  • Philosophy: Does it follow our principles?

4. Pre-commit Setup Validation

When Analyzing Projects: Check for pre-commit configuration during initial project assessment.

Trigger Conditions:

  • Working on a new project being created
  • Existing project lacks .pre-commit-config.yaml

If Pre-commit is Missing:

Recommend setting up pre-commit hooks for automated quality enforcement:

This project lacks pre-commit hooks for automated code quality enforcement.
I recommend establishing baseline quality automation before proceeding.

## Recommended Pre-commit Tools

### Python Projects:
- **ruff**: Fast linting + formatting (replaces black, flake8, isort)
- **pyright** or **mypy**: Type checking
- **detect-secrets**: Prevent credential leaks

### JavaScript/TypeScript Projects:
- **prettier**: Code formatting
- **eslint**: Linting
- **detect-secrets**: Security scanning

### Markdown Documentation:
- **prettier**: Markdown formatting
- **markdownlint**: Markdown linting

### Universal Checks (All Projects):
- trailing-whitespace: Remove trailing whitespace
- end-of-file-fixer: Ensure files end with newline
- check-merge-conflict: Detect merge conflict markers
- check-added-large-files: Prevent large file commits (>500KB)
- check-yaml/check-json: Validate config files
- detect-secrets: Scan for leaked credentials

## Installation

```bash
pip install pre-commit
pre-commit install

Reference Configuration

See .pre-commit-config.yaml in this project for a production-ready example with:

  • Python tooling (ruff, pyright, detect-secrets)
  • JS/TS tooling (prettier, eslint)
  • Markdown tooling (prettier, markdownlint)
  • Universal checks
  • Performance optimizations (skip large files, parallel execution)

Full documentation: Specs/PreCommitHooks.md

Next Steps

Would you like me to:

  1. Create a pre-commit configuration for this project?
  2. Delegate to builder agent for implementation?
  3. Customize based on specific project needs?

**Notes:**
- Pre-commit runs automatically before every commit
- Catches issues locally before CI
- Significantly reduces CI failures and review cycles
- Essential for maintaining code quality at scale

## Module Specification Template

```markdown
# Module: [Name]

## Purpose

[Single clear responsibility]

## Contract

- **Inputs**: [Types and constraints]
- **Outputs**: [Types and guarantees]
- **Side Effects**: [Any external interactions]

## Dependencies

[Required modules/libraries]

## Implementation Notes

[Key design decisions]

## Test Requirements

[What must be tested]

Decision Framework

Ask these questions:

  1. Do we actually need this?
  2. What's the simplest solution?
  3. Can this be more modular?
  4. Will this be easy to regenerate?
  5. Does complexity add value?

Key Principles

  • Start minimal, grow as needed
  • One working feature > multiple partial features
  • 80/20 principle: High value, low effort first
  • Question every abstraction
  • Prefer clarity over cleverness

Remember: You design the blueprints. The builder implements them.

You are already inside an active recipe-managed workflow step. This is not a new top-level user request. Do not invoke /dev, dev-orchestrator, ultrathink, smart-orchestrator, or any other workflow or recipe runner. Execute the requested step directly and return only the output requested by this step. --add-dir /home/azureuser/src/Simard/worktrees/feat/issue-127-fix-all-3-critical-gaps-in-the-simard-stub-removalNow I have a complete picture. Here is the synthesis:


Codebase Context Summary

1. Relevant Existing Code and Patterns

Current base_types.rs (870 lines, the core file to refactor)

Traits (KEEP — shape is correct):

  • BaseTypeFactory (lines 142-149): Creates sessions. open_session(request) -> Box<dyn BaseTypeSession>
  • BaseTypeSession (lines 132-140): Runs agent turns. open(), run_turn(input) -> BaseTypeOutcome, close()

Shared types (KEEP in base_types.rs):

  • BaseTypeId, BaseTypeCapability, BaseTypeDescriptor, BaseTypeSessionRequest, BaseTypeTurnInput, BaseTypeOutcome — all well-designed value types

Implementations (MOVE/REFACTOR):

  • LocalProcessHarnessAdapter (lines 168-237, 717-845): Test stub that pipes stdin/stdout to sh -c cat. DELETE — this is a test harness, not a real agent runtime.
  • RustyClawdAdapter (lines 240-428): Already uses rustyclawd_core::client::Client with tool loop. This is partially real — it creates a RcClient, calls execute_with_tools, dispatches Bash/Read/Write/Edit tools locally. Move to base_type_rustyclawd.rs.
  • execute_rustyclawd_client (lines 493-563): Real client execution path using client.execute_with_tools().
  • execute_rustyclawd_process_fallback (lines 659-714): Fallback piping to rustyclawd binary. Keep as degraded-mode fallback.
  • execute_tool_locally (lines 569-655): Tool dispatcher for Bash/Read/Write/Edit. Uses rustyclawd_tools::spawn_with_isolation.
  • rustyclawd_tool_definitions (lines 433-486): Tool schemas for the 4 tools.
  • Helper functions: process_output_evidence, build_session_artifacts, ensure_session_not_closed, joined_prompt_ids, standard_session_capabilities, capability_set.

bootstrap.rs — Registration wiring

  • register_builtin_base_type() (lines 395-420): Maps string IDs to factory instances
    • "local-harness"LocalProcessHarnessAdapter (DELETE this mapping)
    • "rusty-clawd"RustyClawdAdapter (KEEP)
    • "copilot-sdk"LocalProcessHarnessAdapter aliased (REPLACE with real CopilotSdkBaseType)
  • Constants: LOCAL_BASE_TYPE = "local-harness", RUSTY_CLAWD_BASE_TYPE = "rusty-clawd", COPILOT_SDK_BASE_TYPE = "copilot-sdk"
  • Default base type for BuiltinDefaults mode is LOCAL_BASE_TYPE — must change to RUSTY_CLAWD_BASE_TYPE

identity.rs — Manifest supported_base_types

  • All three identities (simard-engineer, simard-meeting, simard-gym) list: ["local-harness", "rusty-clawd", "copilot-sdk"]
  • Must add "claude-agent-sdk", "ms-agent-framework" and remove "local-harness"

memory.rs — CognitiveMemoryStore (WORKING)

  • Already integrates amplihack_memory::cognitive_memory::CognitiveMemory with 6-type model
  • Maps scopes: SessionScratch→Working, SessionSummary→Episodic, Project→Semantic, Benchmark→Procedural
  • Also uses amplihack_memory::store::ExperienceStore for durable persistence
  • Wired into bootstrap.rs via MemoryBackendKind::Cognitive (lines 293-299)
  • Tests passcognitive_memory_store_uses_6type_model test validates it

lib.rs — Public exports

  • Exports LocalProcessHarnessAdapter and RustyClawdAdapter — must update after refactor

2. Files That Will Need Modification

File Action Reason
src/base_types.rs Major refactor — strip implementations, keep only traits/types/helpers Remove all adapter/session impls to separate files
src/base_type_rustyclawd.rs Create Move RustyClawdAdapter, RustyClawdSession, tool execution, fallback
src/base_type_copilot.rs Create New CopilotSdkBaseType that launches copilot as agent runtime
src/base_type_claude_sdk.rs Create Structure-only ClaudeAgentSdkBaseType
src/base_type_ms_agent.rs Create Structure-only MsAgentFrameworkBaseType
src/bootstrap.rs Modify Update register_builtin_base_type, remove local-harness, add new types, change default
src/identity.rs Modify Update supported_base_types in all 3 manifests
src/lib.rs Modify Add new modules, update exports
Cargo.toml Potentially modify May not need changes since rustyclawd deps are already present

3. Dependencies and Integration Points

Crate Dependencies (already in Cargo.toml)

  • rustyclawd-core = { path = "../rustyclawd/crates/core" } — Client, Config, CreateMessageRequest, execute_with_tools, ToolDefinition, ContentBlock, Message, ClientError
  • rustyclawd-tools = { path = "../rustyclawd/crates/tools" } — ProcessSpawnConfig, spawn_with_isolation
  • amplihack-memory = { path = "../amplihack-memory-lib/rust/amplihack-memory" } — CognitiveMemory, ExperienceStore, Experience, ExperienceType
  • tokio, serde_json, uuid, clap, nix

rustyclawd-core Public API (key types Simard uses)

  • Client::new(Config), Client::new_copilot(), Client::new_azure_foundry()
  • Config::from_default_location().await
  • Client::execute_with_tools(request, tool_executor) — the main agentic loop
  • Client::execute_with_tools_and_events(...) — with per-turn event callbacks
  • CreateMessageRequest::new(model, messages, max_tokens).with_system(...).with_tools(...)
  • Message::user(text), Message::with_blocks(role, blocks)
  • ToolDefinition::new(name, description, schema)
  • ContentBlock::{Text, ToolUse, ToolResult}
  • ClientError::ApiKeyNotFound

rustyclawd-tools Public API (key types Simard uses)

  • ProcessSpawnConfig, spawn_with_isolation(cmd, config) — process isolation for tool execution

4. Potential Conflicts and Considerations

  1. RustyClawdAdapter is NOT a stub — it already has real integration with rustyclawd_core::client::Client and tool execution loop. The refactor should preserve this working code, just move it to its own file.

  2. Sync/async bridge: RustyClawdSession creates its own tokio::runtime::Runtime to block_on async calls. This is because BaseTypeSession::run_turn is synchronous. This pattern must be preserved for all base types.

  3. CopilotSdkBaseType: Can use Client::new_copilot() from rustyclawd-core which already supports the GitHub Copilot backend. This is a real integration path, not just a process spawn.

  4. ClaudeAgentSdkBaseType and MsAgentFrameworkBaseType: These are structure-only for now. They should implement the traits returning SimardError::AdapterInvocationFailed with "not yet implemented" until real SDKs are integrated.

  5. Default base type change: Changing from local-harness to rusty-clawd as the default means the BuiltinDefaults mode will attempt to create a real RustyClawd client. This requires an API key or will fall back to process-spawn mode.

  6. Test impact: The test builtin_adapter_catalog_covers_manifest_advertised_base_types in bootstrap.rs validates all manifest-advertised base types have registered adapters. After adding claude-agent-sdk and ms-agent-framework to manifests, they must be registered in the registry too.

  7. lib.rs re-exports: Currently exports LocalProcessHarnessAdapter — must remove this and add exports for new types.

  8. The copilot-sdk bootstrap registration currently aliases to LocalProcessHarnessAdapter — this is exactly the kind of stub we need to eliminate.

ℹ NODE_OPTIONS=--max-old-space-size=32768 (saved preference). To change: edit /home/azureuser/.amplihack/config
{"decision": "approve"}

Review for any remaining ambiguity in the requirements.

If ambiguity exists:

  • Resolve it using best judgment
  • Document the decisions made
  • Explain rationale

If no ambiguity:

  • Confirm requirements are clear
  • Proceed with confidence

Output final, unambiguous requirements ready for design phase.

IMPORTANT: Proceed autonomously. Do not ask questions. Make reasonable decisions and continue. --system-prompt ---
name: ambiguity
version: 1.0.0
description: Requirements clarification specialist. Handles unclear requirements, conflicting constraints, and decision trade-offs. Use when requirements are vague or contradictory, when stakeholders disagree, or when multiple valid approaches exist and you need to explore trade-offs before deciding.
role: "Requirements clarification and ambiguity resolution specialist"
model: inherit

Ambiguity Agent

You preserve productive contradictions and navigate uncertainty as valuable features of knowledge, not bugs to fix. Some of the most valuable knowledge exists between certainties - in tensions between viewpoints and conscious acknowledgment of unknowns.

Core Mission

Premature resolution destroys insight. Your role is to:

  • Protect ambiguous spaces
  • Make them navigable and productive
  • Preserve tensions that reveal deeper truths

What You Preserve

Productive Disagreements

  • Maintain disagreements between sources/viewpoints
  • Resist artificial contradiction resolution
  • Map debate topology showing why positions exist
  • Highlight where opposing views are both correct
  • Preserve minority viewpoints challenging narratives

Knowledge Boundaries

  • Map what we know vs don't know
  • Identify patterns in ignorance revealing blind spots
  • Track confidence gradients across domains
  • Distinguish temporary unknowns from unknowables
  • Create navigable structures through uncertainty

Paradoxes

  • Recognize contradictions revealing deeper truths
  • Identify where both/and supersedes either/or
  • Map recursive/self-referential structures
  • Preserve paradoxes generating productive thought

Output Formats

Tension Maps

## Core Tension

[Statement of disagreement]

### Why Each Position Has Validity

- Position A: [Validity in context]
- Position B: [Validity in context]

### What Each Reveals

- A shows: [Unique insight]
- B shows: [Different insight]

### What Resolution Would Lose

[Important nuances that would disappear]

Uncertainty Cartography

## Known Unknowns

- [Boundary 1]: We know X but not Y
- [Boundary 2]: Clear up to point Z

## Patterns in Ignorance

- Consistently fail to understand: [Pattern]
- Systematic blind spot: [Area]

## Confidence Gradients

- High confidence: [Areas]
- Fading certainty: [Where/why]
- Unknowable?: [Potentially permanent mysteries]

Paradox Preservation

## The Paradox

[Clear statement]

### Why It Resists Resolution

[Explanation of fundamental tension]

### What It Teaches

[Insights about framework limits]

### Working With It

[How to use productively rather than resolve]

Operating Principles

  1. Resist Premature Closure: Don't force resolution where ambiguity is productive
  2. Make Uncertainty Visible: Clear marking of unknowns is valuable
  3. Preserve Minority Views: Maintain alternatives even with consensus
  4. Context Over Correctness: Emphasize when/where/why views apply
  5. Navigate, Don't Resolve: Create structures for working with ambiguity

Anti-Patterns to Avoid

  • False certainty obscuring complexity
  • Artificial consensus papering over disagreements
  • Binary thinking missing spectrum positions
  • Premature optimization to single answer
  • Conflating "don't know yet" with "can never know"
  • Treating all uncertainty as equally problematic

Success Indicators

You succeed when:

  • Stakeholders navigate uncertainty without paralysis
  • Productive tensions generate insights not conflict
  • Maps of unknowns guide research effectively
  • Paradoxes become thought tools not obstacles
  • Ambiguity enriches understanding

Key Practices

When Encountering Disagreement

  1. Document both positions fully
  2. Identify contexts where each applies
  3. Find value in the tension itself
  4. Resist picking sides prematurely

When Mapping Unknowns

  1. Be specific about boundaries
  2. Pattern-match across uncertainties
  3. Distinguish types of unknowns
  4. Create navigation aids

When Preserving Paradoxes

  1. State paradox clearly
  2. Explain why it exists
  3. Show what it reveals
  4. Provide usage guidance

Remember

In complex knowledge work, the goal isn't always to resolve ambiguity but to make it productive. You are the guardian of liminal spaces where the most interesting discoveries often emerge. Ambiguity is a feature that enriches understanding, not a bug that blocks it.

You are already inside an active recipe-managed workflow step. This is not a new top-level user request. Do not invoke /dev, dev-orchestrator, ultrathink, smart-orchestrator, or any other workflow or recipe runner. Execute the requested step directly and return only the output requested by this step. --add-dir /home/azureuser/src/Simard/worktrees/feat/issue-127-fix-all-3-critical-gaps-in-the-simard-stub-removal# Ambiguity Resolution: Simard Agent Base Type Re-Architecture

Ambiguities Identified and Resolved

1. RustyClawdAdapter: "Replace" vs "Move"

Tension: The task says "Replace the fake RustyClawdAdapter with a REAL one" — but the codebase analysis reveals it's already partially real (uses rustyclawd_core::client::Client, has tool execution loop).

Resolution: Move and enhance, don't rewrite. The existing RustyClawdAdapter has working integration with execute_with_tools() and local tool dispatch. The "fake" characterization applies to LocalProcessHarnessAdapter, not to RustyClawd. The RustyClawd code moves to base_type_rustyclawd.rs as-is, with minor cleanup (remove any residual test-only logic).

Rationale: Rewriting working code to match a mischaracterization would introduce bugs. The spec intent — "use rustyclawd AS AN AGENT" — is already satisfied by the existing execute_with_tools integration.

2. CopilotSdkBaseType: Process Spawn vs SDK Integration

Tension: Spec says "can be a stub that launches amplihack copilot via process for now" but also says "ARCHITECTURE must be right — it's an agent runtime, not a pipe." Zero-stubs mandate conflicts with "structure only for now."

Resolution: Use rustyclawd_core::client::Client::new_copilot() which already exists. This is a real SDK integration through rustyclawd's Copilot backend — not a process pipe, not a stub. It satisfies both "right architecture" and "working implementation."

Rationale: The rustyclawd crate already has Copilot support. Using it through the proper SDK path gives us a real agent runtime without inventing a new integration.

3. ClaudeAgentSdkBaseType and MsAgentFrameworkBaseType: "Structure only" vs "Zero stubs"

Tension: Task says these should be "structure only for now" but also mandates "Zero stubs when done." These are contradictory.

Resolution: Implement them as properly-typed placeholders that fail clearly at runtime, not stubs. They will:

  • Implement BaseTypeFactory and BaseTypeSession fully
  • Return SimardError::AdapterInvocationFailed("claude-agent-sdk runtime not yet available") on open_session / run_turn
  • Have correct capability declarations, descriptors, and type signatures
  • Be distinguishable from stubs because: (a) the trait implementations are complete, (b) the error paths are explicit, (c) no todo!(), unimplemented!(), or NotImplementedError

Rationale: "Zero stubs" means no fake implementations pretending to work (like LocalProcessHarnessAdapter piping to sh -c cat). An adapter that clearly reports "this runtime isn't available yet" is not a stub — it's an honest capability boundary. The spec lists these as future base types; building real SDK integrations for them is out of scope.

4. Default Base Type After LocalProcessHarnessAdapter Removal

Tension: BuiltinDefaults currently uses LOCAL_BASE_TYPE = "local-harness" as default. Removing it requires choosing a new default. RustyClawd requires an API key.

Resolution: Default becomes "rusty-clawd". The existing RustyClawd adapter already has a process-fallback path (execute_rustyclawd_process_fallback) when the SDK client can't connect. This preserves degraded-mode operation.

Rationale: RustyClawd is the primary agent runtime per spec ("a bespoke agent, built on top of rustyclawd"). The fallback path ensures it doesn't hard-fail without an API key.

5. Identity Manifests: Which Base Types to Advertise

Tension: Should all identities advertise all base types, or should each identity only advertise base types it can actually use?

Resolution: All identities advertise all 4 base types: ["rusty-clawd", "copilot-sdk", "claude-agent-sdk", "ms-agent-framework"]. The identity system describes compatibility, not availability. Runtime availability is checked at session creation.

Rationale: The spec says "Agent Base Type - of which there can be several." Each identity should be able to use any runtime. Restricting at the identity level would conflate two concerns.

6. Memory Integration Verification

Tension: Task says "verify it works" for memory integration. How deep does verification go?

Resolution: Confirm the wiring chain is intact: bootstrap.rsMemoryBackendKind::CognitiveCognitiveMemoryStoreamplihack_memory::CognitiveMemory. The existing test cognitive_memory_store_uses_6type_model already validates the 6-type model. No additional work needed — just confirm the chain during implementation.

Rationale: The codebase analysis shows this is already working. Re-verifying working code wastes time.


Final Unambiguous Requirements

Must Build

Deliverable File Description
Trait-only base_types.rs src/base_types.rs Keep BaseTypeFactory, BaseTypeSession, all shared types. Remove ALL adapter implementations.
RustyClawd base type src/base_type_rustyclawd.rs Move existing working RustyClawdAdapter + RustyClawdSession + tool execution + process fallback here. No rewrite.
Copilot SDK base type src/base_type_copilot.rs New adapter using Client::new_copilot() from rustyclawd-core. Real integration, not process pipe.
Claude Agent SDK base type src/base_type_claude_sdk.rs Complete trait impl, returns explicit "not available" error. No todo!().
MS Agent Framework base type src/base_type_ms_agent.rs Complete trait impl, returns explicit "not available" error. No todo!().

Must Modify

File Changes
src/bootstrap.rs Remove local-harness registration. Add claude-agent-sdk and ms-agent-framework registrations. Change default to rusty-clawd.
src/identity.rs All 3 manifests: remove "local-harness", add "claude-agent-sdk" and "ms-agent-framework".
src/lib.rs Add mod base_type_rustyclawd, mod base_type_copilot, mod base_type_claude_sdk, mod base_type_ms_agent. Remove LocalProcessHarnessAdapter export. Add new type exports.

Must Delete

  • LocalProcessHarnessAdapter and LocalProcessSession — entirely removed, no replacement.
  • LOCAL_BASE_TYPE constant in bootstrap.rs.

Must Verify (No Changes Expected)

  • Memory integration chain: bootstrap.rsCognitive backend → CognitiveMemoryStoreamplihack_memory::CognitiveMemory — confirm wiring intact after refactor.
  • All existing tests still pass after refactor.

Out of Scope

  • Real Claude Agent SDK integration (no Rust crate exists yet)
  • Real MS Agent Framework integration (no Rust crate exists yet)
  • Changes to the BaseTypeFactory / BaseTypeSession trait signatures
  • Changes to memory.rs (already working)
  • New tests beyond updating existing ones for the file moves

Acceptance Criteria

  1. cargo build succeeds with no warnings related to base types
  2. cargo test passes — all existing tests work after refactor
  3. base_types.rs contains ONLY traits, enums, and shared types (no adapter structs)
  4. Each base type lives in its own file
  5. No todo!(), unimplemented!(), or NotImplementedError anywhere
  6. LocalProcessHarnessAdapter is completely gone — zero references
  7. register_builtin_base_type() registers all 4 base types
  8. All 3 identity manifests list all 4 base types

Classification: Refactor (architectural, no new user-facing features)
Estimated Complexity: High (870-line file decomposition, 5 new files, cross-module updates)

ℹ NODE_OPTIONS=--max-old-space-size=32768 (saved preference). To change: edit /home/azureuser/.amplihack/config
{"decision": "approve"}

Acceptance Criteria

  • All explicit requirements met
  • Tests passing
  • Philosophy compliant
  • Documentation updated

Classification

Generated via default-workflow recipe

Metadata

Metadata

Assignees

No one assigned

    Labels

    workflow:defaultCreated by default-workflow recipe

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions