knowledge-extract
Extract the lesson from a session that failed, then succeeded, and propose where to codify it.
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
Extract the lesson from a session that failed, then succeeded, and propose where to codify it.
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
استنادا إلى تصنيف SOC المهني
Walk a project from "no values provisioned" to "doctor --secrets is green" — eight idempotent steps with resume support via setup-state.toml. Wraps the secret framework (ADR-023 §3.8) for AI agents and headless onboarding.
Bootstrap devboy from scratch — install the CLI if missing, register the MCP server, run `devboy onboard` for the active agent, optionally bootstrap the secret framework, verify with `doctor`. First-run skill for both manual installs and the Claude Code / Codex plugin.
First-run wizard for the devboy secret framework — walk a fresh project from "no secret manifest, no router, no daemon" to "every required secret provisioned and verified". Idempotent eight-step flow per ADR-023 §3.8 with state at ~/.devboy/secrets/setup-state.toml so the user can resume or skip.
Analyse the user's Claude Code (or other agent) logs and auto-configure the layered-pipeline compression profiles for their tools, models, and workflow.
Diagnose and fix a broken devboy-tools setup — corrupt config, missing tokens, keychain trouble, wrong paths, plugin install failures.
Enumerate and introspect the active tool bundle — names, categories, schemas, how to invoke each tool from the CLI.
| name | knowledge-extract |
| description | Extract the lesson from a session that failed, then succeeded, and propose where to codify it. |
| category | self-feedback |
| version | 1 |
| compatibility | devboy-tools >= 0.18 |
| activation | ["extract the lesson","what did we learn","codify this fix"] |
| tools | ["trace"] |
Inspects a single session trace that went from a failure streak to a
clean success, pulls out what changed between "not working" and
"working", and proposes where the lesson belongs — a SKILL.md edit, an
AGENTS.md / CLAUDE.md bullet, or a ticket. The skill is
read-only. It prints a proposal to stdout; the user decides whether
to act on it.
daily-report flagged as "recovered after
multiple failures".Accept one of:
--session-dir <path> — absolute or relative path to a real
per-session directory such as
.devboy/sessions/<YYYY-MM-DD>/<skill>/<session_id>/. If the
directory contains meta.json and trace.jsonl, use it directly.--pick — interactive mode: enumerate today's <skill>/<session_id>/
directories whose meta.json has outcome = success and errors > 0,
and let the user pick one. This is the common follow-up after
daily-report.Exit with a clear error if neither flag is set or the directory is not a well-formed session.
The extract itself is traced — retros care about how often the team reaches for this skill.
result=$(devboy trace begin --skill knowledge-extract)
SESSION_DIR=$(echo "$result" | jq -r .session_dir)
SESSION_ID=$(echo "$result" | jq -r .session_id)
Record a decision event naming the target session dir.
Read trace.jsonl line by line. Lines that fail to deserialise as
JSON are skipped with a single note event — do not abort. For each
valid record keep: ts, phase, payload.
Compute three spans:
tool_result.ok = false or verify.ok = false — possibly
interleaved with note, decision, or further tool_call events
that target the same tool or check.tool_result.ok = true or verify.ok = true on the same tool or
check as the streak.decision and note events that appear
between the last failing event and the flip point — those record
what the agent or user tried differently.If the trace has no failure streak (only clean successes), print a
short message saying there is nothing to extract and end the meta-
trace with outcome: aborted.
One short paragraph, plain English. Template:
After failing
<tool-or-check><N>times with<common-error>, switching to<approach-described-in-setup-delta>fixed it because<why, if the decision/note events state it>.
If the trace does not justify the "because" clause, leave it out rather than making something up.
Classify the fix and propose exactly one home:
get_pipeline with
includeFailedLogs: false when the MR is large") — propose a
SKILL.md edit on the skill that owns the call. Name the file
(skills/<category>/<skill>/SKILL.md) and quote the exact
sentence to add.CLAUDE.md, AGENTS.md, or
the project's own guide, quoting the sentence.create-issue, including a draft title and two-sentence
reproduction, but do not create it.Only one home per lesson. If the fix really belongs in two places, split the extraction into two successive invocations.
Print to stdout:
# Lesson extracted from <session-dir>
## What happened
<one paragraph>
## Lesson
<one paragraph>
## Proposed codification
Target: skills/02-code-review/review-mr/SKILL.md
Edit:
> Add the following to the "Procedure" section, after step 3:
> "When the MR touches more than 50 files, pass
> includeFailedLogs: false to get_pipeline — otherwise the response
> overflows the context window."
Do not apply the edit. Do not open the file. Do not create the ticket.
devboy trace end \
--session-dir "$SESSION_DIR" --session-id "$SESSION_ID" \
--skill knowledge-extract \
--outcome "$OUTCOME" \
--summary "lesson proposal for <original-skill>"
tool_call /
tool_result / verify events with timestamps from the trace.SKILL.md, never opens a PR, never calls create_issue or
add_issue_comment. Proposals are text on stdout.<redacted:token-pattern> in response body). Do not guess at the underlying value.outcome: aborted.