execution-engine-analysis
Analyze control flow, concurrency models, and event architectures in agent frameworks. Use when (1) understanding async vs sync execution patterns, (2) classifying execution topology (DAG/FSM/Linear), (3) mapping event emission and observability hooks, (4) evaluating scalability characteristics, or (5) comparing execution models across frameworks.
What this skill does
# Execution Engine Analysis
Analyzes the control flow substrate and concurrency model.
## Process
1. **Identify async model** — Native async, sync-with-wrappers, or hybrid
2. **Classify topology** — DAG, FSM, or linear chain
3. **Catalog events** — Callbacks, listeners, generators
4. **Map observability** — Pre/post hooks, interception points
## Concurrency Model Classification
### Native Async
```python
# Signature: async/await throughout
async def run(self):
result = await self.llm.agenerate(messages)
return await self.process(result)
# Entry point uses asyncio
asyncio.run(agent.run())
```
**Indicators**: `async def`, `await`, `asyncio.gather`, `aiohttp`
### Sync with Wrappers
```python
# Signature: sync API wrapping async internals
def run(self):
return asyncio.run(self._async_run())
# Or using thread pools
def run(self):
with ThreadPoolExecutor() as pool:
future = pool.submit(self._blocking_call)
return future.result()
```
**Indicators**: `asyncio.run()` inside sync methods, `ThreadPoolExecutor`, `run_in_executor`
### Hybrid
```python
# Both sync and async APIs exposed
def invoke(self, input):
return self._sync_invoke(input)
async def ainvoke(self, input):
return await self._async_invoke(input)
```
**Indicators**: Paired methods (`invoke`/`ainvoke`), `sync_to_async` decorators
## Execution Topology
### DAG (Directed Acyclic Graph)
```python
# Signature: Nodes with dependencies
class Node:
def __init__(self, deps: list[Node]): ...
graph.add_edge(node_a, node_b)
result = graph.execute() # Topological order
```
**Indicators**: `Graph`, `Node`, `Edge` classes, `networkx`, topological sort
### FSM (Finite State Machine)
```python
# Signature: Explicit states and transitions
class State(Enum):
THINKING = "thinking"
ACTING = "acting"
DONE = "done"
def transition(self, current: State, event: str) -> State:
if current == State.THINKING and event == "action_chosen":
return State.ACTING
```
**Indicators**: State enums, transition tables, `current_state`, state machine libraries
### Linear Chain
```python
# Signature: Sequential step execution
def run(self):
result = self.step1()
result = self.step2(result)
result = self.step3(result)
return result
# Or pipeline pattern
chain = step1 | step2 | step3
result = chain.invoke(input)
```
**Indicators**: Sequential calls, pipe operators (`|`), `Chain`, `Pipeline` classes
## Event Architecture
### Callbacks
```python
class Callbacks:
def on_llm_start(self, prompt): ...
def on_llm_end(self, response): ...
def on_tool_start(self, tool, input): ...
def on_tool_end(self, output): ...
def on_error(self, error): ...
```
**Flexibility**: Low — fixed hook points
**Traceability**: Medium — easy to follow
### Event Listeners/Emitters
```python
emitter = EventEmitter()
emitter.on('llm:start', handler)
emitter.on('tool:*', wildcard_handler)
emitter.emit('llm:start', {'prompt': prompt})
```
**Flexibility**: High — dynamic registration
**Traceability**: Low — harder to trace
### Async Generators (Streaming)
```python
async def run(self):
async for chunk in self.llm.astream(prompt):
yield {"type": "token", "content": chunk}
yield {"type": "done"}
```
**Flexibility**: Medium — streaming-native
**Traceability**: High — follows data flow
## Observability Hooks Inventory
| Hook Point | Purpose | Interception Level |
|------------|---------|-------------------|
| Pre-LLM | Modify prompt | Input |
| Post-LLM | Access raw response | Output |
| Pre-Tool | Validate tool input | Input |
| Post-Tool | Transform tool output | Output |
| Pre-Step | Observe state | Read-only |
| Post-Step | Modify next step | Control flow |
| On-Error | Handle/transform | Error |
### Questions to Answer
- Can you intercept tool input before execution?
- Is the raw LLM response accessible (with token counts)?
- Can you modify control flow from hooks?
- Are hooks sync or async?
## Output Template
```markdown
## Execution Engine Analysis: [Framework Name]
### Concurrency Model
- **Type**: [Native Async / Sync-with-Wrappers / Hybrid]
- **Entry Point**: `path/to/main.py:run()`
- **Thread Safety**: [Yes/No/Partial]
### Execution Topology
- **Model**: [DAG / FSM / Linear Chain]
- **Implementation**: [Description with code refs]
- **Parallelization**: [Supported/Not Supported]
### Event Architecture
- **Pattern**: [Callbacks / Listeners / Generators]
- **Registration**: [Static / Dynamic]
- **Streaming**: [Supported / Not Supported]
### Observability Inventory
| Hook | Location | Async | Modifiable |
|------|----------|-------|------------|
| on_llm_start | callbacks.py:L23 | Yes | Input only |
| on_tool_end | callbacks.py:L45 | Yes | Output |
| ... | ... | ... | ... |
### Scalability Assessment
- **Blocking Operations**: [List any]
- **Resource Limits**: [Token counters, rate limits]
- **Recommended Concurrency**: [Threads/Processes/AsyncIO]
```
## Integration
- **Prerequisite**: `codebase-mapping` to identify execution files
- **Feeds into**: `comparative-matrix` for async decisions
- **Related**: `control-loop-extraction` for agent-specific flow
Related in AI Agents
skill-development
IncludedComprehensive meta-skill for creating, managing, validating, auditing, and distributing Claude Code skills and slash commands (unified in v2.1.3+). Provides skill templates, creation workflows, validation patterns, audit checklists, naming conventions, YAML frontmatter guidance, progressive disclosure examples, and best practices lookup. Use when creating new skills, validating existing skills, auditing skill quality, understanding skill architecture, needing skill templates, learning about YAML frontmatter requirements, progressive disclosure patterns, tool restrictions (allowed-tools), skill composition, skill naming conventions, troubleshooting skill activation issues, creating custom slash commands, configuring command frontmatter, using command arguments ($ARGUMENTS, $1, $2), bash execution in commands, file references in commands, command namespacing, plugin commands, MCP slash commands, Skill tool configuration, or deciding between skills vs slash commands. Delegates to docs-management skill for official documentation.
reprompter
IncludedTransform messy prompts into well-structured, effective prompts — single or multi-agent. Use when: "reprompt", "reprompt this", "clean up this prompt", "structure my prompt", rough text needing XML tags and best practices, "reprompter teams", "repromptception", "run with quality", "smart run", "smart agents", multi-agent tasks, audits, parallel work, anything going to agent teams. Don't use when: simple Q&A, pure chat, immediate execution-only tasks. See "Don't Use When" section for details. Outputs: Structured XML/Markdown prompt, quality score (before/after), optional team brief + per-agent sub-prompts, agent team output files. Success criteria: Single mode quality score ≥ 7/10; Repromptception per-agent prompt quality score 8+/10; all required sections present, actionable and specific.
adaptive-compaction
IncludedAdaptive add-on policy and recovery layer that decides WHEN to compact, prune, snapshot, or fork -- replacing fixed-percent auto-compaction across Claude Code, Codex, and MCP-capable hosts. Trigger on auto-compact timing or damage: "when should I compact", "is it safe to compact now or start a fresh session", "auto-compact fires too early/mid-task", "switching to an unrelated task but the window still has space", "context rot", "answers get worse the longer the session runs", "the agent forgot the plan or my decisions after it summarized", "add a layer on top that manages context without changing the agent", raising autoCompactWindow to give the policy room, or installing/tuning a cross-tool compaction policy or PreCompact hook -- even when "compaction" is never said but the problem is context-window pressure or post-summarization memory loss. Do NOT use to summarize a conversation, build RAG, write a summarization prompt (decides WHEN not HOW), or answer max-context-length trivia.
agent-skill-creator
IncludedCreate cross-platform agent skills from workflow descriptions. Activates when users ask to create an agent, automate a repetitive workflow, create a custom skill, or need advanced agent creation. Triggers on phrases like create agent for, automate workflow, create skill for, every day I have to, daily I need to, turn process into agent, need to automate, create a cross-platform skill, validate this skill, export this skill, migrate this skill. Supports single skills, multi-agent suites, transcript processing, template-based creation, interactive configuration, cross-platform export, and spec validation.
llm-wiki
IncludedUse when building or maintaining a persistent personal knowledge base (second brain) in Obsidian where an LLM incrementally ingests sources, updates entity/concept pages, maintains cross-references, and keeps a synthesis current. Triggers include "second brain", "Obsidian wiki", "personal knowledge management", "ingest this paper/article/book", "build a research wiki", "compound knowledge", "Memex", or whenever the user wants knowledge to accumulate across sessions instead of being re-derived by RAG on every query.
skill-master
IncludedAgent Skills authoring, evaluation, and optimization. Create, edit, validate, benchmark, and improve skills following the agentskills.io specification. Use when designing SKILL.md files, structuring skill folders (references, scripts, assets), ingesting external documentation into skills, running trigger evals, benchmarking skill quality, optimizing descriptions, or performing blind A/B comparisons. Keywords: agentskills.io, SKILL.md, skill authoring, eval, benchmark, trigger optimization.