一键导入
harn-probe
Use to convert a guess about codebase behavior into a recorded observation by running a probe snippet and persisting the outcome as a Fact.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Use to convert a guess about codebase behavior into a recorded observation by running a probe snippet and persisting the outcome as a Fact.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Generate, validate, preview, and run portable Harn workflow bundle JSON for monitoring and repairing pull requests, deploys, logs, and other event-driven engineering work. Optimized for smaller models (qwen, gemma, llama.cpp) with explicit XML sections, strict JSON output, and a validation-and-retry loop.
Use for Harn language syntax, typechecking, modules, imports, and idiomatic script authoring.
Use for autonomous Harn agent work, task decomposition, capability boundaries, and host interaction patterns.
Use for Harn orchestration workflows, agent_loop usage, tool middleware, and handoff design.
Use for Harn provider setup, model routing, provider capability matrices, and llm_call options.
Run a cron eval pack, gate against prior ledger rows, and post Slack only on gate flips.
| name | harn-probe |
| short | Probe-first verification — run snippets, capture outcomes as typed Facts. |
| description | Use to convert a guess about codebase behavior into a recorded observation by running a probe snippet and persisting the outcome as a Fact. |
| when_to_use | Use before asserting a claim about behavior, types, or output that you have not yet verified directly. Especially before destructive edits, before describing what a function returns, or before declaring a refactor safe. |
Use this skill when you are about to assert a claim about runtime
behavior, type-checker output, or command output that you have not
directly observed in this session. Replace the assertion with a
probe(...) call from std/agent/probe, then state the outcome as
observation, not speculation.
Pair it with [[harn-agent]] for autonomous workflows, [[harn-language]]
for the typecheck fragments you feed probe("typecheck", ...), and
[[harn-testing]] for the conformance fixtures that anchor probe-derived
facts.
probe outcome lands in the Fact ledger with
provenance.source = "probe", so a follow-up session can recall the
verified answer instead of re-guessing.rm,
git reset --hard, schema drop, --no-verify) without first
observing that the precondition holds.If you genuinely cannot probe — the surface is non-deterministic, the body is too large, the cost is too high — say so out loud rather than asserting.
std/agent/probe exposes probe(kind, body, options?) plus
probe_eval and probe_typecheck shorthands. Two probe kinds are
implemented today; test and inspect are reserved and currently
return unknown.
probe_eval(body, options) runs body as a shell command by
default. Set options.lang = "harn" to run body as a Harn snippet
via harn run. Outcome is pass on exit 0 and fail otherwise;
options.expected matches against trimmed stdout for a string and
against the integer for a numeric comparison.probe_typecheck(body, options) writes the fragment to a temp file
and runs harn check <path> --json. Outcome is pass when there are
zero errors; options.expected matches the parsed error count.Every probe returns a harn.probe.v1 envelope:
kind, outcome, observed — short summary of what was seen.evidence — trace_id, snippet, command, stdout, stderr,
exit_code, duration_ms, plus timed_out when the host enforced a
deadline.fact_id — id of the auto-stored Observation fact (pass
options.store_fact = false to suppress the write).expected, asserted_at — round-tripped from the input.The Fact body uses confidence = 0.9 for observed pass/fail and
0.4 for unknown, so
recall_facts("…", "Observation", 0.8, scope) returns only
directly-verified outcomes.
options.timeout_ms for anything that could hang.fail is just as
load-bearing as one that comes back pass.invalidate_facts from
std/agent/fact before continuing.fact_id or
evidence.trace_id so the reader can find the same observation.Probes write Observations with provenance.source = "probe" and
provenance.probe_kind = "<kind>". Before re-running a probe, recall
with recall_facts(query, "Observation", 0.0, scope) to see if the
same probe already ran in a recent session. Match by
provenance.probe_kind to scope recall to a particular probe shape
(eval vs typecheck).
When code drift might have invalidated a recalled fact, use
invalidate_facts({kind: "Observation", evidence: {kind: "tool_output", ref: trace_id}}, scope) to tombstone the stale record, then re-probe
and record the fresh outcome.
outcome field because the prose summary
"looks right" — the structured outcome is the contract.observed that contradicts the actual outcome —
keep observed tight and grounded in the captured stdout/stderr.probe("test", ...) or probe("inspect", ...) and expecting a
real outcome — they are reserved and return unknown today; record
the limitation and fall back to probe_eval with the appropriate
test runner command.probe(kind, body, options). Pass options.expected when you
have a specific value or count in mind so the outcome is a hard
match instead of a fuzzy success signal.outcome and observed. Quote
evidence.trace_id or fact_id when summarizing to the user or in
a PR description.import { probe_eval, probe_typecheck } from "std/agent/probe"
// 1. Verify a shell helper before relying on its exit code.
const helper = probe_eval(
"git diff --quiet HEAD -- crates/harn-stdlib",
{expected: 0, timeout_ms: 5000},
)
if helper.outcome != "pass" {
__io_println("stdlib has uncommitted edits — recall fact: " + helper.fact_id)
}
// 2. Confirm a fragment type-checks before pasting it into the user's file.
const tc = probe_typecheck(
"pipeline summary() { const x: int = len([1, 2, 3]) __io_println(x) }\n",
{expected: 0},
)
require tc.outcome == "pass", "fragment fails typecheck: " + tc.observed
cargo test -p harn-stdlib --test stdlib_modules
round-trips the source.cargo run --quiet --bin harn -- test conformance --filter agent_probe.harn run -e 'import {probe_eval} from "std/agent/probe"; __io_println(probe_eval("echo hi").outcome)'.cargo test -p harn-skills covers the embedded corpus
invariants.If probe-first injection slows tasks by more than 50 percent without measurably reducing wrong-assertion incidents over 20 sessions, restrict probing to high-risk operations (before destructive edits, before declaring a refactor safe) or abandon the always-on nudge. Document the kill decision as a Decision fact so future sessions inherit the rationale.