Skip to content

LeoYeAI/agent-master-skills / skills/autoskill

autoskill

Verified

Analyzes user-requested Screenpipe history windows to detect repeated research workflows, match existing scientific skills, and stage new skill drafts or composition recipes for review. Requires a reachable Screenpipe HTTP API, normally on localhost:3030. Detection and embedding inference run locally; the selected LLM receives redacted app/title cluster summaries and matched skill descriptions. Use only when the user explicitly asks to analyze their recent work and propose skills.

FileKindSize
.gitignoreother34 B
SKILL.mdskill md16.5 KB
config.yamlconfig2.1 KB
references/api-contracts.mdmarkdown7.4 KB
references/https-proxy.mdmarkdown2.2 KB
references/screenpipe-config.yamlconfig1.4 KB
scripts/autoskill.pyscript1.1 KB
scripts/backends.pyscript5.1 KB
scripts/cluster.pyscript1.7 KB
scripts/doctor.pyscript4.5 KB
scripts/fetch_window.pyscript2.8 KB
scripts/match_skills.pyscript1.2 KB
scripts/promote.pyscript1.5 KB
scripts/redact.pyscript1.6 KB
scripts/run.pyscript7.4 KB
scripts/synthesize.pyscript2.7 KB

scripts/synthesize.py

View on GitHub
import json
import re

VALID_VERDICTS = {"reuse", "compose", "novel"}


class SynthesisError(Exception):
    pass


def _build_prompt(cluster, top_k_skills):
    apps = ", ".join(cluster["apps"])
    titles = "; ".join(cluster.get("example_titles", []))
    candidates = "\n".join(
        f"- {s['name']} (score={s['score']:.2f}): {s['description']}"
        for s in top_k_skills
    )
    return f"""You are classifying an observed user workflow against an existing skill library.

Cluster:
- apps: {apps}
- sessions: {cluster['session_count']}
- total_duration_seconds: {cluster['total_duration_seconds']}
- example titles: {titles}

Candidate existing skills (ranked by semantic similarity):
{candidates}

Decide one of:
- "reuse": an existing skill already covers this workflow.
- "compose": no single skill covers it, but chaining existing skills does. Draft a thin SKILL.md that invokes them in order.
- "novel": not covered; draft a full new SKILL.md.

Respond with a single JSON object:
- reuse: {{"verdict": "reuse", "target": "<skill-name>"}}
- compose: {{"verdict": "compose", "name": "<new-skill-name>", "skill_body": "<SKILL.md body>"}}
- novel: {{"verdict": "novel", "name": "<new-skill-name>", "skill_body": "<SKILL.md body>"}}
"""


def _extract_json(text: str) -> dict:
    fence = re.search(r"```(?:json)?\s*(\{.*?\})\s*```", text, re.DOTALL)
    if fence:
        candidate = fence.group(1)
    else:
        start = text.find("{")
        end = text.rfind("}")
        if start == -1 or end == -1 or end <= start:
            raise SynthesisError(f"no JSON object found in response: {text!r}")
        candidate = text[start:end + 1]
    try:
        return json.loads(candidate)
    except json.JSONDecodeError as e:
        raise SynthesisError(f"invalid JSON in response: {e}") from e


def synthesize(cluster, top_k_skills, backend):
    prompt = _build_prompt(cluster, top_k_skills)
    response = backend(prompt)
    payload = _extract_json(response)

    verdict = payload.get("verdict")
    if verdict not in VALID_VERDICTS:
        raise SynthesisError(f"unknown verdict: {verdict!r}")

    result = {"verdict": verdict, "skill_body": None}
    if verdict == "reuse":
        result["target"] = payload.get("target")
    else:
        name = payload.get("name")
        body = payload.get("skill_body")
        if (not isinstance(name, str) or not 1 <= len(name) <= 64
                or re.fullmatch(r"[a-z0-9]+(?:-[a-z0-9]+)*", name) is None):
            raise SynthesisError("draft name must be a valid skill name, not a path")
        if not isinstance(body, str) or not body.strip():
            raise SynthesisError("draft skill_body must be a non-empty string")
        result["name"] = name
        result["skill_body"] = body
    return result
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: 471kUpdated 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