fix(install): handle 8.3 source paths, bound plugin delegation, check skill contracts

Sync-ManagedDestination and Copy-Directory cut relative paths by the
length of $Source. With an 8.3 short path such as JULIAN~1, Get-ChildItem
returned long paths, so files landed under a truncated directory name.
Both now expand $Source with Get-Item first.

PowerShell tests now pass -ExecutionPolicy Bypass, tolerate non-UTF-8
console output, and give the Git Bash quick update 300 seconds.

The orchestration rule now covers plugin workflows. A plugin default
alone never authorizes subagents, per-task reviews stay proportional,
parallel writers get disjoint files, and plugin agents keep to their
specialty inside the shared handoff format.

doctor warns when an installed Impeccable or Apple Design skill no
longer names the commands and sections plugin-workflow relies on.
Prompt budget baselines are refreshed to the current values.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Julian LechnerandClaude Opus 5.5 committed 2026-11-18 09:31:00 +01:00
1 parent abc9ae8e1b
commit b8b4438275
15 files changed
+146 -28

No files matched your search

+8 -8
View File
@@ -4,24 +4,24 @@
"permanent_context_hard_limit_tokens": 15000, "permanent_context_hard_limit_tokens": 15000,
"metrics": { "metrics": {
"permanent_context_tokens": { "permanent_context_tokens": {
"claude": 5959, "claude": 6060,
"codex": 4100 "codex": 4201
}, },
"instruction_tokens": { "instruction_tokens": {
"claude": 1670, "claude": 1835,
"codex": 1670 "codex": 1835
}, },
"skill_metadata_tokens": { "skill_metadata_tokens": {
"claude": 3354, "claude": 3290,
"codex": 1575 "codex": 1512
}, },
"auto_loaded_rule_tokens": { "auto_loaded_rule_tokens": {
"claude": 732, "claude": 732,
"codex": 731 "codex": 731
}, },
"rule_catalog_tokens": { "rule_catalog_tokens": {
"claude": 36519, "claude": 37438,
"codex": 8944 "codex": 9747
}, },
"agent_metadata_tokens": { "agent_metadata_tokens": {
"claude": 204, "claude": 204,
+8 -8
View File
@@ -1,13 +1,13 @@
metric client baseline_tokens metric client baseline_tokens
permanent_context_tokens claude 5959 permanent_context_tokens claude 6060
permanent_context_tokens codex 4100 permanent_context_tokens codex 4201
instruction_tokens claude 1670 instruction_tokens claude 1835
instruction_tokens codex 1670 instruction_tokens codex 1835
skill_metadata_tokens claude 3354 skill_metadata_tokens claude 3290
skill_metadata_tokens codex 1575 skill_metadata_tokens codex 1512
auto_loaded_rule_tokens claude 732 auto_loaded_rule_tokens claude 732
auto_loaded_rule_tokens codex 731 auto_loaded_rule_tokens codex 731
rule_catalog_tokens claude 36519 rule_catalog_tokens claude 37438
rule_catalog_tokens codex 8944 rule_catalog_tokens codex 9747
agent_metadata_tokens claude 204 agent_metadata_tokens claude 204
agent_metadata_tokens codex 124 agent_metadata_tokens codex 124
1 metric client baseline_tokens
2 permanent_context_tokens claude 5959 6060
3 permanent_context_tokens codex 4100 4201
4 instruction_tokens claude 1670 1835
5 instruction_tokens codex 1670 1835
6 skill_metadata_tokens claude 3354 3290
7 skill_metadata_tokens codex 1575 1512
8 auto_loaded_rule_tokens claude 732
9 auto_loaded_rule_tokens codex 731
10 rule_catalog_tokens claude 36519 37438
11 rule_catalog_tokens codex 8944 9747
12 agent_metadata_tokens claude 204
13 agent_metadata_tokens codex 124
+2
View File
@@ -24,6 +24,8 @@ Assignments contain a concrete task, allowed scope and ownership, success criter
The shared [orchestration rule](../shared/rules/orchestration.md) defines the `RESULT`, `EVIDENCE`, `CHANGES`, `RISKS`, and optional `NEXT` handoff. Codex loads it as a rule file; Claude loads the generated `rules-orchestration` skill. Agent adapters add only the client-specific loading instruction. The protocol body is not copied into every role or permanent prompt. The shared [orchestration rule](../shared/rules/orchestration.md) defines the `RESULT`, `EVIDENCE`, `CHANGES`, `RISKS`, and optional `NEXT` handoff. Codex loads it as a rule file; Claude loads the generated `rules-orchestration` skill. Agent adapters add only the client-specific loading instruction. The protocol body is not copied into every role or permanent prompt.
The same rule bounds delegation that plugins suggest, such as Superpowers' subagent workflows. A plugin default alone never authorizes subagents, per-task reviews stay proportional, parallel writers get disjoint files, and plugin or built-in agents are used only for their own specialty. Their output goes inside the shared handoff sections. See [Plugin workflows and agents](../shared/rules/orchestration.md#plugin-workflows-and-agents).
## Task state ## Task state
See the [canonical task-state policy](../shared/rules/orchestration.md#canonical-task-state) for when to use state and what it may contain. The optional `.ai-session/state.json` file is local handoff state for a long-running active goal, not persistent project memory. See the [canonical task-state policy](../shared/rules/orchestration.md#canonical-task-state) for when to use state and what it may contain. The optional `.ai-session/state.json` file is local handoff state for a long-running active goal, not persistent project memory.
+2
View File
@@ -69,6 +69,7 @@ On Windows, an unavailable profile-folder lookup falls back to PowerShell's home
| `tests/test-client-smoke.py` | Install a package into a temporary home with foreign settings and ask the installed Claude and Codex CLIs which skills, agents, and hooks they discover, without completing a model request. Skips a client whose CLI is unavailable unless `AI_CONFIG_REQUIRE_CLIENTS=1`, which the CI `client-smoke` job sets. | | `tests/test-client-smoke.py` | Install a package into a temporary home with foreign settings and ask the installed Claude and Codex CLIs which skills, agents, and hooks they discover, without completing a model request. Skips a client whose CLI is unavailable unless `AI_CONFIG_REQUIRE_CLIENTS=1`, which the CI `client-smoke` job sets. |
| `tests/test-install-options.py` | Validate interactive option handling and generated manifest changes. | | `tests/test-install-options.py` | Validate interactive option handling and generated manifest changes. |
| `tests/test-managed-extensions.py` | Validate plugin, skill, and CLI ownership handling. | | `tests/test-managed-extensions.py` | Validate plugin, skill, and CLI ownership handling. |
| `tests/test-skill-contracts.py` | Validate the doctor check that installed Impeccable and Apple Design skills still name what `plugin-workflow` coordinates. |
| `tests/test-managed-install.ps1`, `tests/test-managed-install.sh` | Validate managed-file synchronization and backups. | | `tests/test-managed-install.ps1`, `tests/test-managed-install.sh` | Validate managed-file synchronization and backups. |
| `tests/test-plugin-selection.ps1`, `tests/test-plugin-selection.sh` | Validate plugin selection. | | `tests/test-plugin-selection.ps1`, `tests/test-plugin-selection.sh` | Validate plugin selection. |
| `tests/test-prompt-budget.py` | Validate prompt budget threshold evaluation. | | `tests/test-prompt-budget.py` | Validate prompt budget threshold evaluation. |
@@ -152,4 +153,5 @@ Benchmark fixture READMEs describe the starting task state and are retained as t
| `lib/selection-state.py` | Read and write Quickupdate state. | | `lib/selection-state.py` | Read and write Quickupdate state. |
| `lib/qmd.sh`, `lib/qmd.ps1` | Invoke local QMD search from the installation flow. | | `lib/qmd.sh`, `lib/qmd.ps1` | Invoke local QMD search from the installation flow. |
| `lib/qmd.py` | Install, migrate, benchmark, and remove local QMD search. | | `lib/qmd.py` | Install, migrate, benchmark, and remove local QMD search. |
| `lib/skill-contracts.py` | Doctor check: warn when an upstream Impeccable or Apple Design update no longer names the commands and sections `plugin-workflow` relies on. |
| [`shared/qmd/`](../shared/qmd/) (repository root) | Installed QMD scripts: search CLI, daemon, warm-up, benchmark, and shared library. | | [`shared/qmd/`](../shared/qmd/) (repository root) | Installed QMD scripts: search CLI, daemon, warm-up, benchmark, and shared library. |
+1
View File
@@ -69,6 +69,7 @@ New-Item $output -ItemType Directory | Out-Null
function Copy-Directory($source, $destination) { function Copy-Directory($source, $destination) {
New-Item $destination -ItemType Directory -Force | Out-Null New-Item $destination -ItemType Directory -Force | Out-Null
$source = (Get-Item -LiteralPath $source).FullName # expand 8.3 short paths so the prefix cut lines up
Get-ChildItem $source -File -Recurse | ForEach-Object { Get-ChildItem $source -File -Recurse | ForEach-Object {
$relative = $_.FullName.Substring($source.Length).TrimStart([char[]]@('\','/')) $relative = $_.FullName.Substring($source.Length).TrimStart([char[]]@('\','/'))
$target = Join-Path $destination $relative $target = Join-Path $destination $relative
+4
View File
@@ -56,6 +56,10 @@ if ($python) {
$qmdChecks = Invoke-DoctorCommand -Command $python.Path -Arguments (@($python.Arguments) + @((Join-Path $root 'scripts/lib/qmd.py'), 'doctor', '--root', $root, '--home', $homePath)) $qmdChecks = Invoke-DoctorCommand -Command $python.Path -Arguments (@($python.Arguments) + @((Join-Path $root 'scripts/lib/qmd.py'), 'doctor', '--root', $root, '--home', $homePath))
if ($qmdChecks.ExitCode -ne 0) { Result 'WARN' "QMD checks failed: $($qmdChecks.Output -join ' ')" } if ($qmdChecks.ExitCode -ne 0) { Result 'WARN' "QMD checks failed: $($qmdChecks.Output -join ' ')" }
else { foreach ($line in $qmdChecks.Output) { if ("$line" -match '^(PASS|WARN|FAIL) (.+)$') { Result $Matches[1] $Matches[2] } } } else { foreach ($line in $qmdChecks.Output) { if ("$line" -match '^(PASS|WARN|FAIL) (.+)$') { Result $Matches[1] $Matches[2] } } }
# Upstream skill updates can rename what plugin-workflow coordinates; reports nothing when neither skill is installed.
$contractChecks = Invoke-DoctorCommand -Command $python.Path -Arguments (@($python.Arguments) + @((Join-Path $root 'scripts/lib/skill-contracts.py'), '--home', $homePath))
if ($contractChecks.ExitCode -ne 0) { Result 'WARN' "Skill contract checks failed: $($contractChecks.Output -join ' ')" }
else { foreach ($line in $contractChecks.Output) { if ("$line" -match '^(PASS|WARN|FAIL) (.+)$') { Result $Matches[1] $Matches[2] } } }
} }
$sourceAgentCount = @(Get-ChildItem (Join-Path $root 'shared/agents') -Directory -ErrorAction SilentlyContinue).Count $sourceAgentCount = @(Get-ChildItem (Join-Path $root 'shared/agents') -Directory -ErrorAction SilentlyContinue).Count
+8
View File
@@ -64,6 +64,14 @@ if resolve_python; then
else else
result WARN "QMD checks failed: ${qmd_output//$'\n'/ }" result WARN "QMD checks failed: ${qmd_output//$'\n'/ }"
fi fi
# Upstream skill updates can rename what plugin-workflow coordinates; reports nothing when neither skill is installed.
if contract_output=$(run_python "$root/scripts/lib/skill-contracts.py" --home "$home_path" 2>&1); then
while IFS= read -r line; do
case "$line" in PASS\ *|WARN\ *|FAIL\ *) result "${line%% *}" "${line#* }" ;; esac
done <<< "$contract_output"
else
result WARN "Skill contract checks failed: ${contract_output//$'\n'/ }"
fi
fi fi
source_agent_count=$(find "$root/shared/agents" -mindepth 1 -maxdepth 1 -type d 2>/dev/null | wc -l) source_agent_count=$(find "$root/shared/agents" -mindepth 1 -maxdepth 1 -type d 2>/dev/null | wc -l)
+2
View File
@@ -221,6 +221,8 @@ function Invoke-ManagedSync {
# Plan every change before writing anything, so the journal can describe the whole run. # Plan every change before writing anything, so the journal can describe the whole run.
$plan = New-Object System.Collections.ArrayList $plan = New-Object System.Collections.ArrayList
# Get-ChildItem returns long paths; expand an 8.3 short $Source (such as JULIAN~1) so the prefix cut below lines up.
$Source = (Get-Item -LiteralPath $Source).FullName
Get-ChildItem $Source -File -Recurse | ForEach-Object { Get-ChildItem $Source -File -Recurse | ForEach-Object {
$relative = $_.FullName.Substring($Source.Length).TrimStart([char[]]@('\','/')).Replace('\','/') $relative = $_.FullName.Substring($Source.Length).TrimStart([char[]]@('\','/')).Replace('\','/')
if ((Split-Path $Destination -Leaf) -eq '.codex' -and $relative.StartsWith('skills/')) { return } if ((Split-Path $Destination -Leaf) -eq '.codex' -and $relative.StartsWith('skills/')) { return }
+48
View File
@@ -0,0 +1,48 @@
"""Doctor check: installed upstream skills still offer what plugin-workflow's UI section names."""
import argparse
from pathlib import Path
# Keep in sync with the Impeccable and Apple Design section of shared/skills/plugin-workflow/SKILL.md.
CONTRACTS = {
'impeccable': ('Impeccable', ['critique', 'audit', 'harden', 'adapt', 'clarify', 'layout', 'typeset', 'polish',
'shape', 'craft-floor', 'Operate', 'Persuade']),
'apple-design': ('Apple Design', ['Always load', 'Lens 1', 'Lens 5', 'Critical', 'Design improvement mode',
'cross-platform']),
}
def installed_skill_files(home, skill):
candidates = [home / '.claude/skills' / skill / 'SKILL.md', home / '.agents/skills' / skill / 'SKILL.md',
home / '.codex/skills' / skill / 'SKILL.md']
cache = home / '.claude/plugins/cache' / skill / skill
if cache.is_dir():
versions = sorted((p for p in cache.iterdir() if (p / 'skills' / skill / 'SKILL.md').is_file()),
key=lambda p: tuple(int(part) if part.isdigit() else 0 for part in p.name.split('.')))
if versions:
candidates.append(versions[-1] / 'skills' / skill / 'SKILL.md')
return [path for path in candidates if path.is_file()]
def check(home):
results = []
for skill, (name, tokens) in CONTRACTS.items():
for path in installed_skill_files(home, skill):
text = path.read_text(encoding='utf-8', errors='replace')
missing = [token for token in tokens if token not in text]
if missing:
results.append(('WARN', f'{name} at {path.parent} no longer mentions {", ".join(missing)}; '
'review the UI section of plugin-workflow'))
else:
results.append(('PASS', f'{name} at {path.parent} matches the plugin-workflow coordination'))
return results
def main():
parser = argparse.ArgumentParser()
parser.add_argument('--home', required=True)
for status, message in check(Path(parser.parse_args().home)):
print(f'{status} {message}')
if __name__ == '__main__':
main()
+4 -4
View File
@@ -243,7 +243,7 @@ class InstallOptionsTests(unittest.TestCase):
environment = dict(os.environ, OPTION_SOURCE=str(source), OPTION_DESTINATION=str(destination)) environment = dict(os.environ, OPTION_SOURCE=str(source), OPTION_DESTINATION=str(destination))
for enabled in (False, True): for enabled in (False, True):
if kind == 'powershell': if kind == 'powershell':
command = [executable, '-NoProfile', '-Command', command = [executable, '-NoProfile', '-ExecutionPolicy', 'Bypass', '-Command',
"$ErrorActionPreference='Stop'; . ./scripts/lib/manifest.ps1; " "$ErrorActionPreference='Stop'; . ./scripts/lib/manifest.ps1; "
"Sync-ManagedDestination -Source $env:OPTION_SOURCE -Destination $env:OPTION_DESTINATION " "Sync-ManagedDestination -Source $env:OPTION_SOURCE -Destination $env:OPTION_DESTINATION "
"-Stamp test -AiConfigRoot root -ShellCommand bash -PowerShellCommand pwsh " "-Stamp test -AiConfigRoot root -ShellCommand bash -PowerShellCommand pwsh "
@@ -254,7 +254,7 @@ class InstallOptionsTests(unittest.TestCase):
'sync_managed_destination "$OPTION_SOURCE" "$OPTION_DESTINATION" test root bash pwsh false true ' 'sync_managed_destination "$OPTION_SOURCE" "$OPTION_DESTINATION" test root bash pwsh false true '
+ str(enabled).lower()] + str(enabled).lower()]
environment.update(OPTION_SOURCE=source.as_posix(), OPTION_DESTINATION=destination.as_posix()) environment.update(OPTION_SOURCE=source.as_posix(), OPTION_DESTINATION=destination.as_posix())
result = subprocess.run(command, cwd=ROOT, env=environment, capture_output=True, text=True, timeout=20) result = subprocess.run(command, cwd=ROOT, env=environment, capture_output=True, text=True, errors='replace', timeout=20)
self.assertEqual(result.returncode, 0, result.stdout + result.stderr) self.assertEqual(result.returncode, 0, result.stdout + result.stderr)
installed = json.loads((destination / 'settings.json').read_text(encoding='utf-8-sig')) installed = json.loads((destination / 'settings.json').read_text(encoding='utf-8-sig'))
self.assertEqual('Stop' in installed['hooks'], enabled) self.assertEqual('Stop' in installed['hooks'], enabled)
@@ -315,11 +315,11 @@ class InstallOptionsTests(unittest.TestCase):
environment = dict(os.environ, HOME=home.as_posix(), TEST_INSTALL_HOME=str(home)) environment = dict(os.environ, HOME=home.as_posix(), TEST_INSTALL_HOME=str(home))
for name, quick, answers in [('install', False, 'n\nn\nn\n'), ('update', True, '')]: for name, quick, answers in [('install', False, 'n\nn\nn\n'), ('update', True, '')]:
entry = str(commands / (name + '.' + suffix)) entry = str(commands / (name + '.' + suffix))
command = ([executable, '-NoProfile', '-File', entry, '-Shell', 'Bash', '-Client', 'Both', '-Summary'] command = ([executable, '-NoProfile', '-ExecutionPolicy', 'Bypass', '-File', entry, '-Shell', 'Bash', '-Client', 'Both', '-Summary']
if kind == 'powershell' else [executable, entry, '--shell', 'bash', '--client', 'both', '--summary']) if kind == 'powershell' else [executable, entry, '--shell', 'bash', '--client', 'both', '--summary'])
if quick: if quick:
command.append('-Quick' if kind == 'powershell' else '--quick') command.append('-Quick' if kind == 'powershell' else '--quick')
result = subprocess.run(command, env=environment, input=answers, capture_output=True, text=True, timeout=25) result = subprocess.run(command, env=environment, input=answers, capture_output=True, text=True, errors='replace', timeout=25)
self.assertEqual(result.returncode, 0, result.stdout + result.stderr) self.assertEqual(result.returncode, 0, result.stdout + result.stderr)
self.assertNotIn('CLI-MOCK', result.stdout) self.assertNotIn('CLI-MOCK', result.stdout)
if quick: if quick:
+2 -2
View File
@@ -118,7 +118,7 @@ class PersonalInstructionTests(unittest.TestCase):
def sync(client, dry=False): def sync(client, dry=False):
self.environment['TEST_CLIENT'] = client self.environment['TEST_CLIENT'] = client
if shell == 'powershell': if shell == 'powershell':
return self.run_command(str(executable), '-NoProfile', '-Command', return self.run_command(str(executable), '-NoProfile', '-ExecutionPolicy', 'Bypass', '-Command',
". ./scripts/lib/manifest.ps1; Sync-ManagedDestination -Source $env:TEST_SOURCE " ". ./scripts/lib/manifest.ps1; Sync-ManagedDestination -Source $env:TEST_SOURCE "
"-Destination (Join-Path $env:TEST_HOME ('.' + $env:TEST_CLIENT)) -Stamp test -Summary " "-Destination (Join-Path $env:TEST_HOME ('.' + $env:TEST_CLIENT)) -Stamp test -Summary "
+ ('-DryRun' if dry else '')) + ('-DryRun' if dry else ''))
@@ -129,7 +129,7 @@ class PersonalInstructionTests(unittest.TestCase):
def change(action): def change(action):
if shell == 'powershell': if shell == 'powershell':
self.run_command(str(executable), '-NoProfile', '-File', str(ROOT / f'scripts/commands/{action}-instruction.ps1'), self.run_command(str(executable), '-NoProfile', '-ExecutionPolicy', 'Bypass', '-File', str(ROOT / f'scripts/commands/{action}-instruction.ps1'),
'-Client', 'Both', '-Instruction', 'Use English.', '-HomePath', str(self.home)) '-Client', 'Both', '-Instruction', 'Use English.', '-HomePath', str(self.home))
else: else:
self.run_command(str(executable), '-c', self.run_command(str(executable), '-c',
+5 -5
View File
@@ -114,7 +114,7 @@ class SelectionTests(unittest.TestCase):
if not shell: if not shell:
self.skipTest('PowerShell unavailable') self.skipTest('PowerShell unavailable')
environment = dict(os.environ, TEST_SELECTION_HOME=str(self.home), TEST_REPOSITORY_ROOT=str(ROOT)) environment = dict(os.environ, TEST_SELECTION_HOME=str(self.home), TEST_REPOSITORY_ROOT=str(ROOT))
save = subprocess.run([shell, '-NoProfile', '-Command', save = subprocess.run([shell, '-NoProfile', '-ExecutionPolicy', 'Bypass', '-Command',
"$ErrorActionPreference = 'Stop'; . (Join-Path $env:TEST_REPOSITORY_ROOT 'scripts/lib/selection-state.ps1'); " "$ErrorActionPreference = 'Stop'; . (Join-Path $env:TEST_REPOSITORY_ROOT 'scripts/lib/selection-state.ps1'); "
"Save-UpdateSelection -HomePath $env:TEST_SELECTION_HOME -RepositoryRoot $env:TEST_REPOSITORY_ROOT " "Save-UpdateSelection -HomePath $env:TEST_SELECTION_HOME -RepositoryRoot $env:TEST_REPOSITORY_ROOT "
"-Shell PowerShell -Client Both -Flashbang $false -StatusLine $false -Plugins @{ Selected = @([pscustomobject]@{name='Superpowers'}); Deselected = @() }"], "-Shell PowerShell -Client Both -Flashbang $false -StatusLine $false -Plugins @{ Selected = @([pscustomobject]@{name='Superpowers'}); Deselected = @() }"],
@@ -128,15 +128,15 @@ class SelectionTests(unittest.TestCase):
stream.write(source) stream.write(source)
entry = Path(stream.name) entry = Path(stream.name)
self.addCleanup(entry.unlink) self.addCleanup(entry.unlink)
result = subprocess.run([shell, '-NoProfile', '-File', str(entry), '-Quick', '-DryRun'], result = subprocess.run([shell, '-NoProfile', '-ExecutionPolicy', 'Bypass', '-File', str(entry), '-Quick', '-DryRun'],
env=environment, stdin=subprocess.DEVNULL, capture_output=True, text=True, timeout=90) env=environment, stdin=subprocess.DEVNULL, capture_output=True, text=True, timeout=300) # Git Bash on Windows needs ~3 min
self.assertEqual(result.returncode, 0, result.stdout + result.stderr) self.assertEqual(result.returncode, 0, result.stdout + result.stderr)
self.assertNotIn('Select plugins', result.stdout) self.assertNotIn('Select plugins', result.stdout)
self.assertIn('DRYRUN ensure codex plugin: Superpowers', result.stdout) self.assertIn('DRYRUN ensure codex plugin: Superpowers', result.stdout)
self.assertNotIn('DRYRUN ensure codex plugin: Context7', result.stdout) self.assertNotIn('DRYRUN ensure codex plugin: Context7', result.stdout)
self.assertEqual(self.path.read_bytes(), original) self.assertEqual(self.path.read_bytes(), original)
self.assertFalse((self.home / '.codex').exists()) self.assertFalse((self.home / '.codex').exists())
failed = subprocess.run([shell, '-NoProfile', '-File', str(entry), '-Quick'], env=environment, failed = subprocess.run([shell, '-NoProfile', '-ExecutionPolicy', 'Bypass', '-File', str(entry), '-Quick'], env=environment,
stdin=subprocess.DEVNULL, capture_output=True, text=True, timeout=10) stdin=subprocess.DEVNULL, capture_output=True, text=True, timeout=10)
self.assertNotEqual(failed.returncode, 0) self.assertNotEqual(failed.returncode, 0)
self.assertEqual(self.path.read_bytes(), original) self.assertEqual(self.path.read_bytes(), original)
@@ -158,7 +158,7 @@ class SelectionTests(unittest.TestCase):
original = self.path.read_bytes() original = self.path.read_bytes()
environment = dict(os.environ, HOME=self.home.as_posix()) environment = dict(os.environ, HOME=self.home.as_posix())
result = subprocess.run([shell, str(ROOT / 'scripts/commands/update.sh'), '--quick', '--dry-run'], result = subprocess.run([shell, str(ROOT / 'scripts/commands/update.sh'), '--quick', '--dry-run'],
env=environment, stdin=subprocess.DEVNULL, capture_output=True, text=True, timeout=90) env=environment, stdin=subprocess.DEVNULL, capture_output=True, text=True, timeout=300) # Git Bash on Windows needs ~3 min
self.assertEqual(result.returncode, 0, result.stdout + result.stderr) self.assertEqual(result.returncode, 0, result.stdout + result.stderr)
self.assertNotIn('Select plugins', result.stdout) self.assertNotIn('Select plugins', result.stdout)
self.assertIn('DRYRUN ensure codex plugin: Superpowers', result.stdout) self.assertIn('DRYRUN ensure codex plugin: Superpowers', result.stdout)
+42
View File
@@ -0,0 +1,42 @@
import importlib.util
from pathlib import Path
import tempfile
import unittest
ROOT = Path(__file__).resolve().parents[2]
SPEC = importlib.util.spec_from_file_location('contracts', ROOT / 'scripts/lib/skill-contracts.py')
CONTRACTS = importlib.util.module_from_spec(SPEC)
SPEC.loader.exec_module(CONTRACTS)
class SkillContractTests(unittest.TestCase):
def setUp(self):
directory = tempfile.TemporaryDirectory()
self.addCleanup(directory.cleanup)
self.home = Path(directory.name)
def write(self, relative, text):
path = self.home / relative
path.parent.mkdir(parents=True, exist_ok=True)
path.write_text(text, encoding='utf-8')
def test_reports_nothing_when_skills_are_absent(self):
self.assertEqual([], CONTRACTS.check(self.home))
def test_passes_complete_skill_and_warns_on_missing_names(self):
self.write('.claude/skills/apple-design/SKILL.md', ' '.join(CONTRACTS.CONTRACTS['apple-design'][1]))
self.write('.agents/skills/impeccable/SKILL.md', 'critique audit')
results = dict((message.split(' at ')[0], status) for status, message in CONTRACTS.check(self.home))
self.assertEqual({'Apple Design': 'PASS', 'Impeccable': 'WARN'}, results)
def test_uses_highest_cached_plugin_version(self):
tokens = ' '.join(CONTRACTS.CONTRACTS['impeccable'][1])
self.write('.claude/plugins/cache/impeccable/impeccable/4.10.0/skills/impeccable/SKILL.md', tokens)
self.write('.claude/plugins/cache/impeccable/impeccable/4.9.2/skills/impeccable/SKILL.md', 'old')
[(status, message)] = CONTRACTS.check(self.home)
self.assertEqual('PASS', status)
self.assertIn('4.10.0', message)
if __name__ == '__main__':
unittest.main()
+9
View File
@@ -10,6 +10,15 @@ Each assignment contains only: concrete task, allowed scope/ownership, success c
Start at supplied references. Retrieve additional symbols, callers, tests, configuration, or applicable rules only to resolve a concrete question. Reuse reliable findings; reread when code changed or evidence is insufficient. Return unresolved business decisions to the main agent. Start at supplied references. Retrieve additional symbols, callers, tests, configuration, or applicable rules only to resolve a concrete question. Reuse reliable findings; reread when code changed or evidence is insufficient. Return unresolved business decisions to the main agent.
## Plugin workflows and agents
These rules bound every delegation, including delegation that plugin workflows suggest. A plugin default alone never authorizes subagents. Delegate when the user asks for it, or when the main agent judges under the rules above that independent work outweighs the duplicated context and tool cost.
- Plugin delegation workflows such as Superpowers `subagent-driven-development` or `dispatching-parallel-agents` keep their structure, with these limits: one implementer per independent, non-trivial task; trivial tasks stay with the main agent or the same implementer; per-task review is proportional (one combined spec and quality review for risky tasks, self-review otherwise) plus one final review of the whole change.
- Parallel writers need disjoint file ownership, stated in each assignment. Never let two writers edit the same files; run overlapping tasks one after another.
- Choose the agent by purpose. Prefer the shared roles: `researcher` for evidence and external sources, `architect` for design choices, `implementer`, `reviewer`, and `verifier`. Use a client's built-in read-only search agent for broad location searches that need only a conclusion. Use plugin agents only for their own specialty, such as Impeccable's agents inside an Impeccable workflow or Caveman's crew agents for narrow one- or two-file tasks while Caveman is active. The same ownership, tool limits, and no-spawning rules apply to every agent.
- The handoff protocol below is the envelope for every agent. Plugin-specific content, such as a required status line, findings in a plugin's own format, or compressed wording, goes inside its sections. Evidence, paths, commands, and errors stay verbatim.
## Handoff ## Handoff
Use these headings; omit empty optional sections: Use these headings; omit empty optional sections:
+1 -1
View File
@@ -13,7 +13,7 @@ MUST load `using-superpowers` for development tasks and the matching skill befor
- Features/behavior changes: `brainstorming`; multi-step plans: `writing-plans`. - Features/behavior changes: `brainstorming`; multi-step plans: `writing-plans`.
- Bugs/failures: `systematic-debugging` before fixing. - Bugs/failures: `systematic-debugging` before fixing.
- Accepted plans: `executing-plans`; delegate only when authorized and useful. - Accepted plans: `executing-plans`. Delegation, including Superpowers' subagent workflows, follows the orchestration rules (`rules/orchestration.md` / `rules-orchestration`); a plugin default alone never authorizes subagents.
- Behavior requiring regression coverage: `test-driven-development`. - Behavior requiring regression coverage: `test-driven-development`.
- Review requests/feedback: `requesting-code-review`/`receiving-code-review`. - Review requests/feedback: `requesting-code-review`/`receiving-code-review`.
- Completion claims: `verification-before-completion`, with matching evidence. - Completion claims: `verification-before-completion`, with matching evidence.