🔋 Power Adapter API¶
The Power Adapter parses Kiro Power configurations and includes them in the spec memory.
Overview¶
When SpecMem scans a repository, the Power Adapter detects installed Kiro Powers in .kiro/powers/ and converts their documentation into searchable SpecBlocks.
PowerAdapter Class¶
specmem.adapters.power.PowerAdapter
¶
Bases: SpecAdapter
Adapter for Kiro Power configurations.
Detects and parses: - .kiro/powers//POWER.md - Power documentation - .kiro/powers//steering/.md - Steering files - .kiro/powers//mcp.json - MCP configuration (for tool metadata)
Source code in specmem/adapters/power.py
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 | |
Attributes¶
name
property
¶
Functions¶
detect(repo_path)
¶
Check if any Powers are installed in the repository.
Source code in specmem/adapters/power.py
load(repo_path)
¶
Load and parse all Power configurations.
Source code in specmem/adapters/power.py
Data Models¶
PowerInfo¶
Information about an installed Kiro Power.
from dataclasses import dataclass, field
from pathlib import Path
@dataclass
class PowerInfo:
"""Information about an installed Kiro Power."""
name: str
path: Path
description: str = ""
tools: list[ToolInfo] = field(default_factory=list)
steering_files: list[Path] = field(default_factory=list)
keywords: list[str] = field(default_factory=list)
version: str | None = None
| Field | Type | Description |
|---|---|---|
name |
str | Power display name |
path |
Path | Path to Power directory |
description |
str | Power description |
tools |
list[ToolInfo] | MCP tools provided |
steering_files |
list[Path] | Steering file paths |
keywords |
list[str] | Discovery keywords |
version |
str | Power version |
ToolInfo¶
Information about an MCP tool.
@dataclass
class ToolInfo:
"""Information about an MCP tool."""
name: str
description: str
input_schema: dict = field(default_factory=dict)
| Field | Type | Description |
|---|---|---|
name |
str | Tool name |
description |
str | Tool description |
input_schema |
dict | JSON Schema for inputs |
Usage¶
Basic Usage¶
from specmem.adapters.power import PowerAdapter
adapter = PowerAdapter()
# Check if Powers are installed
if adapter.detect("/path/to/repo"):
# Load Power documentation as SpecBlocks
blocks = adapter.load("/path/to/repo")
print(f"Loaded {len(blocks)} blocks from Powers")
With SpecMem Client¶
The Power Adapter is automatically used when scanning:
from specmem import SpecMemClient
client = SpecMemClient()
client.scan() # Automatically detects and indexes Powers
What Gets Parsed¶
POWER.md¶
The main Power documentation file is parsed into:
- Overview block (
SpecType.KNOWLEDGE) - Power name, description, version - Section blocks - Each
##section becomes a separate block - Tool blocks (
SpecType.DESIGN) - One block per MCP tool
Steering Files¶
Files in steering/*.md are parsed as:
- Workflow blocks (
SpecType.TASK) - Workflow guides and instructions
mcp.json¶
The MCP configuration provides:
- Display name and description
- Keywords for discovery
- Tool metadata (names, descriptions, schemas)
SpecBlock Types¶
Powers create SpecBlocks with these types:
| Content | SpecType | Description |
|---|---|---|
| POWER.md overview | KNOWLEDGE |
Power documentation |
| Tool descriptions | DESIGN |
Tool architecture |
| Steering files | TASK |
Workflow guides |
Tags¶
Power SpecBlocks are tagged for easy filtering:
# Overview block tags
["power", "power_name", "keyword1", "keyword2"]
# Tool block tags
["power", "tool", "tool_name", "power_name"]
# Steering block tags
["power", "steering", "power_name", "file_stem"]
Directory Structure¶
Expected Power directory structure:
.kiro/powers/
└── power-name/
├── POWER.md # Required - Power documentation
├── mcp.json # Optional - MCP configuration
└── steering/ # Optional - Steering files
├── getting-started.md
└── workflows.md
Error Handling¶
The adapter handles errors gracefully:
| Condition | Behavior |
|---|---|
| Missing POWER.md | Skip Power, log warning |
| Malformed POWER.md | Extract what's possible |
| Missing steering/ | Continue without steering files |
| Invalid mcp.json | Skip tool metadata, log warning |
Configuration¶
Enable/disable the Power adapter in .specmem.toml:
[adapters]
power = true # Default: true
[adapters.power]
powers_dir = ".kiro/powers" # Default location
Integration with Impact Graph¶
Powers are integrated into the SpecImpact graph:
- Each Power becomes a
POWERnode - Steering files that reference code patterns create edges
- Query impact to see Power relationships
from specmem import SpecMemClient
client = SpecMemClient()
impact = client.get_impact_set(["src/auth.py"])
# Check for Power relationships
for node in impact.nodes:
if node.type == "POWER":
print(f"Affected Power: {node.name}")
See Also¶
- Kiro Powers Integration - User guide
- Writing Adapters - Create custom adapters
- Adapters Overview - All available adapters