Skip to content

j-mauro-r/SAT-Dengue-V2 / .agents/skills/deepworkplan

deepworkplan

Verified

DeepWorkPlan — turn any repo AI-first and run Deep Work Plans. Routes to create, execute, refine, resume, status, verify, upgrade, and repo-onboarding sub-skills based on intent. Use when the developer wants to plan, execute, manage, or verify structured multi-task work, or make a repository AI-agent-ready.

FileKindSize
SKILL.mdskill md12.0 KB
TRUST.mdmarkdown16.1 KB
addons/README.mdmarkdown11.7 KB
addons/machine-installs.mdmarkdown2.9 KB
examples/CREATE_PLAN.mdmarkdown6.9 KB
examples/ORCHESTRATOR_TASK_TEMPLATE_create_child_dwp.mdmarkdown15.0 KB
examples/ORCHESTRATOR_TASK_TEMPLATE_execute_child_dwp.mdmarkdown16.7 KB
examples/ORCHESTRATOR_TASK_TEMPLATE_integration_checkpoint.mdmarkdown9.0 KB
examples/PROMPTS_TEMPLATE.mdmarkdown4.0 KB
examples/TEAM_AGENTS_TASK_TEMPLATE.mdmarkdown5.1 KB
examples/V6_PLAN_EXAMPLE.mdmarkdown5.5 KB
guide/GUIDE.mdmarkdown8.0 KB
guide/authoring.mdmarkdown28.5 KB
guide/execution.mdmarkdown21.0 KB
guide/large-repo-onboarding.mdmarkdown3.3 KB
guide/orchestration-at-scale.mdmarkdown11.4 KB
guide/orchestrator.mdmarkdown37.9 KB
guide/prompts.mdmarkdown10.1 KB
guide/skills-integration.mdmarkdown6.5 KB
guide/structure.mdmarkdown6.2 KB
guide/swarm.mdmarkdown21.2 KB
guide/team-agents.mdmarkdown12.3 KB
shared/adaptation.mdmarkdown2.7 KB
shared/addon_sync.pyscript17.7 KB
shared/benchmark.pyscript97.6 KB
shared/config.pyscript41.5 KB
shared/context.shscript4.2 KB
shared/context_manifest.pyscript40.8 KB
shared/contract_v6.pyscript82.7 KB
shared/delegators.pyscript3.0 KB
shared/dwp-paths.mdmarkdown5.8 KB
shared/finalize_plan.pyscript7.2 KB
shared/install-verification.mdmarkdown1.8 KB
shared/ledger.pyscript141.5 KB
shared/migrate_v6.pyscript46.5 KB
shared/outcomes.pyscript27.2 KB
shared/plan_paths.pyscript4.8 KB
shared/resources.pyscript49.0 KB
shared/scheduler.pyscript41.6 KB
shared/state_contract.pyscript9.8 KB
shared/swarm.pyscript27.3 KB
shared/troubleshooting.mdmarkdown7.4 KB
shared/update-state.pyscript12.5 KB
shared/views.pyscript21.0 KB
shared/working-principles.mdmarkdown7.1 KB
spec/ADDONS.mdmarkdown27.4 KB
spec/AGENT_PROTOCOL.mdmarkdown28.0 KB
spec/ARCHETYPES.mdmarkdown10.6 KB
spec/BENCHMARK.mdmarkdown20.3 KB
spec/CONFIG.mdmarkdown8.7 KB
spec/DOCUMENTATION_STANDARD.mdmarkdown40.7 KB
spec/DWP_SPECIFICATION.mdmarkdown65.1 KB
spec/LITE_PLANS.mdmarkdown4.0 KB
spec/PLAN_STATE.mdmarkdown34.9 KB
spec/README.mdmarkdown11.5 KB
spec/V6_CONTEXT.mdmarkdown6.4 KB
spec/V6_CONTRACT.mdmarkdown12.3 KB
spec/V6_LIFECYCLE.mdmarkdown13.5 KB
spec/V6_RESOURCES.mdmarkdown4.7 KB
spec/V7_ABILITIES.mdmarkdown4.9 KB
spec/V7_CONTRACT.mdmarkdown6.4 KB
spec/V7_ROADMAP.mdmarkdown4.6 KB
spec/schema/addon-descriptor-v1.schema.jsonconfig5.5 KB
spec/schema/benchmark-record.schema.jsonconfig14.0 KB
spec/schema/context-manifest-v6.schema.jsonconfig12.5 KB
spec/schema/dwp-config-v1.schema.jsonconfig3.5 KB
spec/schema/dwp-handoff-v1.schema.jsonconfig3.0 KB
spec/schema/journal-event-v6.schema.jsonconfig22.3 KB
spec/schema/journal-event-v7.schema.jsonconfig24.9 KB
spec/schema/learnings-record.schema.jsonconfig6.0 KB
spec/schema/plan-contract-v6.schema.jsonconfig16.4 KB
spec/schema/plan-contract-v7.schema.jsonconfig16.6 KB
spec/schema/plan-manifest-v2.schema.jsonconfig1.0 KB
spec/schema/plan-manifest-v5.schema.jsonconfig1.3 KB
spec/schema/plan-manifest-v6.schema.jsonconfig2.0 KB
spec/schema/plan-manifest-v7.schema.jsonconfig1.7 KB
spec/schema/plan-manifest.schema.jsonconfig1.8 KB
spec/schema/plan-snapshot-v6.schema.jsonconfig7.8 KB
spec/schema/plan-state-v2.schema.jsonconfig6.4 KB
spec/schema/plan-state-v5.schema.jsonconfig6.7 KB
spec/schema/plan-state.schema.jsonconfig3.7 KB

shared/finalize_plan.py

View on GitHub
#!/usr/bin/env python3
"""Validate and publish a completed projection without inventing gate evidence.

Usage: python3 shared/finalize_plan.py PLAN --candidate STATE.json
The candidate contains only previously earned source/acceptance evidence.
Markdown is authored first; this helper never edits it or runs recorded commands.
An interrupted publication leaves .finalizing.json and requires explicit recovery.
"""
import argparse
import hashlib
import json
import re
import os
from pathlib import Path
import sys
import tempfile

sys.dont_write_bytecode = True
sys.path.insert(0, str(Path(__file__).resolve().parent.parent/'verify'))
from plan_contract import check, field_content, unfenced
from state_contract import state_errors


def atomic(path, data):
    fd, temp = tempfile.mkstemp(dir=path.parent, prefix='.'+path.name, suffix='.tmp')
    try:
        with os.fdopen(fd, 'wb') as stream:
            stream.write(data)
        os.replace(temp, path)
    finally:
        if os.path.exists(temp):
            os.unlink(temp)


def validate(plan, candidate):
    errors = state_errors(candidate, strict=True, plan_dir=plan)
    if candidate.get('status') != 'completed':
        errors.append('candidate is not completed')
    if errors:
        raise ValueError('; '.join(errors))
    result = check(plan, state_override=candidate, allow_finalizing=True)
    if result.failed:
        raise ValueError('; '.join(x for x in result.lines if not x.startswith(('+ ', '~ '))))
    readme = (plan/'README.md').read_text()
    for task in candidate['tasks']:
        loc = task.get('locator')
        if loc and loc['kind'] == 'inline':
            # Read only this inline record; a later task's disposition cannot mask it.
            # `re` is imported at module scope. A function-local `import re`
            # here once bound `re` as a local for the WHOLE function, so a
            # Full plan — every locator `kind: file`, this branch never taken —
            # hit an UnboundLocalError at the first `re` use further down, and
            # guarded publication was unreachable for Full plans entirely.
            match = re.search(r'(?m)^#{2,6} .*\{'+re.escape(loc['value'])+r'\}.*$', readme)
            if not match:
                raise ValueError('missing inline task record')
            tail = readme[match.end():]
            end = re.search(r'(?m)^## ', tail)
            body = tail[:end.start()] if end else tail
        else:
            body = (plan/(loc['value'] if loc else task['file'])).read_text()
        log = field_content(unfenced(body), 'Completion & Log') or field_content(unfenced(body), 'Completion log')
        # field_content stops at sublabels; dispositions are searched only in the task.
        # Name which condition failed: "requires a completed log" sent a reader
        # hunting through a log that was already complete when the real fault
        # was an unparseable heading.
        missing = []
        if not log:
            missing.append('no readable "Completion & Log" section — check the heading '
                           'is "## Completion & Log", optionally numbered and with a '
                           'parenthetical suffix, and nothing else on the line')
        elif re.search(r'(?im)^\s*(?:\*\*)?status(?:\*\*)?\s*:?\s*(?:\*\*)?\s*pending\b', log):
            # Match the STATUS LINE, not the word anywhere in the log. A
            # substring test refused a completed plan whose log said
            # "before appending either leg" — "appending" contains "pending" —
            # and reported that the log said pending, which was false. The
            # read-only checker already used a status-line rule
            # (plan_contract.log_status_mismatch); the finalizer now matches it.
            missing.append('its log\'s status line still says pending')
        if 'Skills disposition:' not in body:
            missing.append('no "Skills disposition:" line')
        if 'Documentation decision:' not in body:
            missing.append('no "Documentation decision:" line')
        if missing:
            raise ValueError(f'task {task["id"]} cannot be published: ' + '; '.join(missing))


def fingerprint(plan, candidate):
    """Relevant plan artifacts only; receipts do not fingerprint themselves."""
    files = {'README.md','PROGRESS.md','PROMPTS.md','manifest.json',
             'analysis_results/SECURITY_REVIEW.md','analysis_results/SKILLS_CANDIDATES.md'}
    for task in candidate['tasks']:
        loc = task.get('locator')
        if loc and loc['kind']=='file':
            files.add(loc['value'])
        elif not loc:
            files.add(task['file'])
    digest = hashlib.sha256()
    for name in sorted(files):
        path = plan/name
        digest.update(name.encode()+b'\0'+(path.read_bytes() if path.exists() else b'<absent>'))
    return digest.hexdigest()


def publish(plan, candidate, expected=None, recover=False, fault=None):
    """fault is an internal test callback, never a CLI/environment bypass."""
    plan = Path(plan)
    state_path = plan/'state.json'
    original = state_path.read_bytes()
    if expected and hashlib.sha256(original).hexdigest()!=expected:
        raise ValueError('stale state snapshot')
    marker = plan/'.finalizing.json'
    lock = plan/'state.json.lock'
    if marker.exists() and not recover:
        raise ValueError('interrupted finalization: inspect evidence and use --recover')
    lock.mkdir()  # Cooperating writers use the same lock as update-state.py.
    try:
        validate(plan, candidate)
        before = fingerprint(plan, candidate)
        payload = (json.dumps(candidate, indent=2, ensure_ascii=False)+'\n').encode()
        digest = hashlib.sha256(payload).hexdigest()
        atomic(marker, json.dumps({'candidate_sha256':digest,'artifacts_sha256':before}).encode())
        if fault:
            fault('before_publish')
        if state_path.read_bytes()!=original or fingerprint(plan,candidate)!=before:
            raise ValueError('plan changed during validation')
        atomic(state_path, payload)
        if fault:
            fault('after_publish')
        actual = json.loads(state_path.read_text())
        validate(plan, actual)
        if fingerprint(plan,actual)!=before or state_path.read_bytes()!=payload:
            raise ValueError('plan changed after publication')
        receipt = plan/'analysis_results/FINALIZATION.json'
        atomic(receipt, (json.dumps({'state_sha256':digest,'artifacts_sha256':before,
                                    'result':'verified'},indent=2)+'\n').encode())
        marker.unlink()
    finally:
        lock.rmdir()


def main():
    parser=argparse.ArgumentParser(description=__doc__)
    parser.add_argument('plan',type=Path)
    parser.add_argument('--candidate',type=Path,required=True)
    parser.add_argument('--expected-sha256')
    parser.add_argument('--recover',action='store_true')
    args=parser.parse_args()
    try:
        publish(args.plan,json.loads(args.candidate.read_text()),args.expected_sha256,args.recover)
    except (OSError,ValueError,KeyError,TypeError) as exc:
        print(f'finalize-plan: NOT COMPLETED: {exc}',file=sys.stderr)
        return 1
    print('Final artifacts verified; no recorded commands were executed.')
    return 0


if __name__=='__main__':
    sys.exit(main())
reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness.Stars: 322kUpdated Claude CodeCodexVerifiedInstall
dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependenciesStars: 322kUpdated Claude CodeCodexVerifiedInstall
executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is availableStars: 322kUpdated Claude CodeCodexVerifiedInstall