🛠️ Skill Creator (Miner)
The Skill Creator — internally gitd/skills/auto_creator.py, sometimes called the Skill Miner — is Ghost’s mechanism for producing skills automatically from an LLM’s exploration of an app.
Planned feature.
ghost skill mineis not implemented in v1.6.0;gitd/skills/auto_creator.pyis a BFS state explorer with no LLM calls and no v2 output. This page describes the design. Until it ships, author skills by hand or import them (see Creating Skills).
It is designed to solve the Tier 2 (Adapt) + Tier 3 (Mine) cases of the Skills acquisition model: when a skill doesn’t exactly match your device, or when no skill exists at all, an agent runs the miner and emits a fresh v2 skill.
The pattern
Section titled “The pattern”Agent drives phone │ ▼Every tool call → recorded in a trace │ ▼Trace → Skill Miner │ BFS: discovers screen states, deduplicates, extracts stable locators ▼Emits: skill.yaml (v2) + helpers.py + SOFT.md skeleton │ ▼Agent lightly polishes (or you tweak) │ ▼ghost skill validate + test + submitKey insight: Schema v2 was designed to be near-1:1 with an LLM’s tool-call output. Every step primitive matches an MCP tool name (tap_element, type_text, wait_for_text, launch_intent). Selectors mirror tool-call args. Validators can be inferred from the observed terminal screen (“agent saw text X → emit text_visible: {text: X}”).
Two invocation modes
Section titled “Two invocation modes”Mine a specific action
Section titled “Mine a specific action”ghost skill mine skillhub/alice/whatsapp-messaging \ --action send_msg \ --ref-prompt "Text John Smith saying I'll be late"Runs the agent with the given ref_prompt, records the trace, appends the action to the skill’s actions[] list. Existing actions untouched.
Mine from scratch
Section titled “Mine from scratch”ghost skill mine skillhub/alice/whatsapp-full \ --app com.whatsapp \ --exploreBFS-explore the app from launch, discover ~20-40 screens, propose actions the LLM can articulate (from screen affordances). Emits a starter skill.yaml with candidate actions the author refines.
Under the hood
Section titled “Under the hood”The miner does three things:
1. Trace capture
- Runs the agent against the target app
- Records every tool call (name, args, result)
- Records every screen dump (a11y XML) + screenshot
- Records validator observations at each step
2. State-graph analysis
- Deduplicates screens by content-hash (skip similar states)
- Extracts stable locators per element (prefers content-desc > resource-id > text > coord)
- Detects popups (transient modals) vs. screens (persistent state)
- Maps ref_prompt → step sequence
3. YAML emission
- Steps become
- {action: <tool_name>, ...args}entries - Parameters extracted from repeated string values ({contact_name} substitution)
- Popup detectors emitted from transient-modal patterns
end_state_validatordrafted from 2-3 terminal-screen affordancesref_prompt= the original user request or a paraphrase
Trace→YAML mapping (rules)
Section titled “Trace→YAML mapping (rules)”For any LLM agent that just drove your phone, the Skill Miner (or the LLM directly) can follow these rules to emit valid v2 yaml:
- Every tool call becomes a step — copy the tool name as
action:, args as sibling keys - Parameterize repeated values — same string typed as search + same string tapped in results is likely
{contact_name}→ extract toparams: - Emit an
end_state_validatorby observing the terminal screen — 2-3 things you can assert (text visible, checkmark shown, URL contains) - Emit a
ref_prompt— the natural-language phrase the user gave (or a paraphrase) - Decision mid-trace on novel content → wrap as
checkpoint: {reason: llm_decision, ...}— declares the flow soft, warns future replay - Custom helper invoked (not in atomic set) → emit
python_action: <module>:<func>+ ship helper alongside → raises trust badge tohas_python: true
Ghost ships a skill-creation-guide skill (meta-tier) that packages these rules + worked examples so any competent LLM can be handed a trace + this guide and produce a submission-ready skill dir.
Popup catalog growth (—update-popups)
Section titled “Popup catalog growth (—update-popups)”ghost skill mine ghost/tiktok --update-popupsPost-processes recent runs/<id>/unknown-popup-*.png artifacts (from Layer 4 safety-net captures) into detector proposals. OCR each screenshot, propose a {detect, button, label} entry, ask the author to confirm.
Empirical grow-your-catalog workflow — replaces manual popup discovery.
Adapt (Tier 2)
Section titled “Adapt (Tier 2)”When a skill’s fingerprint doesn’t exactly match your device (e.g. your Pixel 10 vs. author’s Samsung S24), the engine calls the miner in adapt mode:
- Loads the existing hard-skill(s) with nearest fingerprint(s) as concrete reference
- Loads the skill’s
SOFT.mdas semantic narrative - LLM re-mines the flow on YOUR device
- Emits a new hard-skill for YOUR fingerprint (stored locally, optionally submitted back to community)
Adapt-mode uses fewer tokens than mine-mode because it has the reference structure — LLM only re-verifies + re-emits the drift.
Distance-based cutoff (designed, not yet in the engine): 0 → Hit, 1-2 → warn + try, 3+ → Adapt automatically.
Other starting points: import and migrate
Section titled “Other starting points: import and migrate”Mining is not the only way to get a first draft. Two commands turn existing automation into a v2 skill without any LLM tokens:
ghost skill import --maestro login_flow.yaml --out skillhub/<you>/my-appghost skill import --automate my_flow.flo --out skillhub/<you>/my-appghost skill migrate skillhub/<you>/old-v1-skill [--dry-run]importreads a Maestro YAML flow or an Automate flow export and writes a skill folder:skill.yamlwith one action per flow, ahelpers.pystub,README.md,SOFT.md, and the original source kept next to them. Steps that map one to one become v2 steps; anything else stays as a TODO step for you to finish. If the flow does not end on a wait the importer can turn into a validator, the action gets a TODO end-state validator.generated_with:records the importer, and a multi-app source must be split into one skill per app. Native binary Automate.flofiles are kept verbatim with a TODO placeholder; nothing in them is executed or decoded.migratewraps an older v1 skill (Pythonactions/andworkflows/classes, a recorded flow, or a FLOW.md-only soft skill) as Schema v2 in place. v1 files stay, so the old runtime keeps working.
Either way, review the result before replaying it: fill the TODOs, check the fingerprint and data_access, then run ghost skill lint and ghost skill test --live.
Related
Section titled “Related”- Skill System — how the emitted skills execute
- Creating Skills — author flow (mine as one option)
- What Are Skills? — the 3-tier acquisition model
- Execution Engine — runtime that consumes the emitted skills
Skill Creator agent guide
Section titled “Skill Creator agent guide”The companion agent skill is skillhub/_guides/skill-creation-guide/SKILL.md
(ghost-skill-creation-guide). Use it to turn explored actions or a trace into a
versioned hub skill: scaffold, author steps and validators, write SOFT.md notes,
validate, lint, analyze, run with signed evidence, record with ghost skill demo,
then prepare ghost skill submit. Push and publish only when the user requests it.
HARD is deterministic replay; SOFT is reference notes read through get_skill_notes;
a captcha is a GATE. The general ghost guide handles everyday phone tasks.