This document records the stable machine-readable contracts exposed by jcode-harness. Fields may be added in future releases, but existing fields should not be removed or renamed without a migration note.
Command:
jcode-harness safe-eval --jsonShape:
{
"profile": "safe-eval",
"root": "/repo",
"jcode_home": "/repo/.jcode/safe-eval/home",
"runtime_dir": "/repo/.jcode/safe-eval/home/runtime",
"env_file": "/repo/.jcode/safe-eval/safe-eval.env",
"powershell_env_file": "/repo/.jcode/safe-eval/safe-eval.ps1",
"guide_file": "/repo/.jcode/safe-eval/README.md",
"source_command": "source '/repo/.jcode/safe-eval/safe-eval.env'",
"powershell_command": ". '/repo/.jcode/safe-eval/safe-eval.ps1'",
"env": [
{ "name": "JCODE_HOME", "value": "/repo/.jcode/safe-eval/home" },
{ "name": "JCODE_SAFE_EVAL", "value": "1" },
{ "name": "JCODE_NO_TELEMETRY", "value": "1" }
],
"disabled_surfaces": ["telemetry", "ambient autonomous cycles"],
"files_written": ["/repo/.jcode/safe-eval/safe-eval.env"],
"files_skipped": []
}Guarantees:
profileis alwayssafe-eval.envlists the environment variables written to both activation files.source_commandis a POSIX shell activation hint;powershell_commandis a PowerShell activation hint.files_writtenandfiles_skippedare absolute or cwd-relative paths matching the operator-provided--cwd/--homevalues.- The command is deterministic and does not contact model providers or start MCP/browser/Gmail integrations.
Command:
jcode-harness doctor --jsonShape:
{
"status": "warn",
"offline": true,
"root": "/repo",
"platform": { "os": "linux", "arch": "x86_64" },
"jcode_home": {
"path": "/repo/.jcode/safe-eval/home",
"source": "env",
"exists": true
},
"safe_eval": {
"active": true,
"active_marker": true,
"active_home_matches_profile": true,
"profile_dir": "/repo/.jcode/safe-eval",
"expected_home": "/repo/.jcode/safe-eval/home",
"files": [
{ "name": "posix_env", "path": "/repo/.jcode/safe-eval/safe-eval.env", "exists": true }
]
},
"privacy": {
"jcode_no_telemetry": true,
"do_not_track": true,
"telemetry_opted_out": true
},
"features": {
"ambient_enabled_env": "false",
"swarm_enabled_env": "false",
"memory_backend_env": "off"
},
"skills": { "status": "ok", "builtins": 4, "loaded": 4 },
"mcp": {
"configs": [
{
"scope": "project-jcode",
"path": "/repo/.jcode/mcp.json",
"exists": false,
"requires_review": false
}
]
},
"recommendations": []
}Guarantees:
offlineis alwaystrue; the command does not initialize providers or start MCP/browser/Gmail integrations.statusisokwhen there are no recommendations, otherwisewarn.safe_evalreports both the explicitJCODE_SAFE_EVAL=1marker and whether activeJCODE_HOMEmatches the generated profile home.mcp.configsreports candidate config paths and marks project-local configs asrequires_reviewonly when they exist.recommendationsis an array of operator-facing strings suitable for onboarding checklists.
Used by skills list --json, skills show <name> --json, skills doctor --json, and resolved entries in skills match <goal> --json.
{
"name": "karpathy-guidelines",
"description": "Skill description",
"origin": "built-in",
"path": "<builtin>/.jcode/skills/karpathy-guidelines/SKILL.md",
"allowed_tools": null
}Field meanings:
name: stable skill identifier from frontmatter.description: frontmatter description.origin: one ofbuilt-in,claude-compat,global,project-local, orunknown.path: effective source path. Built-ins use virtual<builtin>/...paths.allowed_tools:nullor an array of tool names parsed fromallowed-toolsfrontmatter.
Command:
jcode-harness skills list --jsonShape:
{
"skills": [
{
"name": "karpathy-guidelines",
"description": "Skill description",
"origin": "built-in",
"path": "<builtin>/.jcode/skills/karpathy-guidelines/SKILL.md",
"allowed_tools": null
}
]
}Guarantees:
skillsis an array sorted by skill name.- Entries are final effective skills after precedence resolution.
Command:
jcode-harness skills show karpathy-guidelines --jsonShape:
{
"name": "karpathy-guidelines",
"description": "Skill description",
"origin": "built-in",
"path": "<builtin>/.jcode/skills/karpathy-guidelines/SKILL.md",
"allowed_tools": null,
"content": "Markdown body without YAML frontmatter"
}Guarantees:
- Returns the final effective skill for
name. contentis the markdown body after frontmatter parsing.- Missing skills exit non-zero with a human-readable error.
Command:
jcode-harness skills doctor --jsonShape:
{
"skills_loaded": 3,
"builtins": [
{
"name": "karpathy-guidelines",
"status": "ok",
"path": "<builtin>/.jcode/skills/karpathy-guidelines/SKILL.md"
}
],
"duplicates": [
{
"name": "example-skill",
"entries": [
{
"name": "example-skill",
"origin": "global",
"path": "/home/user/.jcode/skills/example-skill/SKILL.md"
}
]
}
],
"skills": []
}Guarantees:
skills_loadedequals the length of final effectiveskills.builtinsreports required embedded skill availability withstatusokormissing.duplicatesreports discovered duplicate names across standard origins before precedence resolution.skillsis the same effective-entry shape asskills list --json.
Commands:
jcode-harness skills scope init --json
jcode-harness skills scope set optimization --state blocked --reason "benchmark-only" --json
jcode-harness skills scope list --jsonShape:
{
"policy_path": "/repo/.jcode/skills.scope.json",
"exists": true,
"created": true,
"updated": false,
"policy": {
"version": 1,
"default_state": "visible",
"skills": [
{
"name": "optimization",
"state": "blocked",
"reason": "benchmark-only"
}
]
}
}Policy file shape, stored at .jcode/skills.scope.json:
{
"version": 1,
"default_state": "visible",
"skills": [
{ "name": "llmwiki-memory", "state": "discoverable", "reason": "manual provenance only" }
]
}Guarantees:
- States are
visible,discoverable, orblocked. visibleskills can be selected automatically or explicitly.discoverableskills are skipped during automatic routing, but allowed when passed with--skill.blockedskills are removed from both automatic and explicit selection.skills match --jsonandjcode-harness run --dry-runhonor this policy before injecting skill prompts.- Invalid skill names containing path separators,
.., or unsupported characters are rejected.
Command:
jcode-harness skills import --json
jcode-harness skills import --from .claude/skills --apply --jsonShape:
{
"status": "ok",
"offline": true,
"dry_run": true,
"root": "/repo",
"target": {
"scope": "project",
"path": "/repo/.jcode/skills"
},
"force": false,
"planned": 1,
"copied": 0,
"skipped": 0,
"errors": 0,
"warnings": 0,
"sources": [
{
"origin": "agents",
"path": "/repo/.agents/skills",
"exists": true,
"checked": 1
}
],
"findings": [],
"actions": [
{
"name": "repo-reviewer",
"source_origin": "agents",
"source_path": "/repo/.agents/skills/repo-reviewer",
"target_path": "/repo/.jcode/skills/repo-reviewer",
"action": "copy",
"applied": false,
"findings": []
}
]
}Guarantees:
offlineis alwaystrue; import planning never invokes providers, MCP servers, browser, or Gmail integrations.- The command is dry-run by default. Files are copied only when
--applyis passed. - Default source discovery checks
./.agents/skills,./.claude/skills,./.codex/skills, and./.jcode/skills; repeated--from <dir>values replace the default source set. - Relative
--fromvalues are resolved against--cwdor the current directory. - Default target is project scope at
./.jcode/skills;--scope globaltargets$JCODE_HOME/skills. - Existing target skills are reported as
skip-existingunless--forceis passed with--apply. - Import refuses to copy symlinks during apply and reports copy failures as
errors, causing a non-zero exit after printing JSON. - Action values currently include
copy,overwrite,skip-existing,skip-invalid,skip-same-target, anderror.
Command:
jcode-harness skills validate --cwd . --jsonShape:
{
"status": "ok",
"offline": true,
"root": "/repo",
"checked": 5,
"valid": 5,
"invalid": 0,
"errors": 0,
"warnings": 0,
"origins": [
{
"origin": "project-local",
"path": "/repo/.jcode/skills",
"exists": true,
"checked": 1
}
],
"findings": [
{
"severity": "warning",
"code": "prompt-injection-phrase",
"origin": "project-local",
"path": "/repo/.jcode/skills/example/SKILL.md",
"message": "Skill contains a common prompt-injection phrase; review before enabling it"
}
],
"skills": [
{
"name": "repo-reviewer",
"description": "Project review rules",
"origin": "project-local",
"path": "/repo/.jcode/skills/repo-reviewer/SKILL.md",
"valid": true,
"effective": true,
"precedence_rank": 30,
"allowed_tools": ["read", "grep"],
"issues": []
}
]
}Guarantees:
offlineis alwaystrue; validation never invokes providers, MCP servers, browser, or Gmail integrations.- Standard origins are checked in runtime precedence order: built-in,
./.claude/skills,$JCODE_HOME/skills, then./.jcode/skills. statusiserrorwhen invalid skill files are found,warnwhen only warnings exist, andokwhen there are no warning/error findings.- The command exits non-zero when
errors > 0, while still printing the JSON report to stdout for CI parsers. findingsincludes normalizedseverity, stablecode,origin,path, and human-readablemessagefields.skills[].effectivemarks the final highest-precedence valid definition when the winner is deterministic.- Current validation errors include missing/invalid frontmatter and unsupported
allowed-toolsshapes; comma-separated strings and YAML lists are accepted. Warnings include empty bodies, directory/name mismatches, same-precedence duplicates, common prompt-injection phrases, suspicious inline secrets, and risky shell snippets.
Command:
jcode-harness skills match "fix this Rust bug" --skill repo-reviewer --jsonShape:
{
"goal": "fix this Rust bug",
"mode": "auto",
"selected": [
{
"name": "repo-reviewer",
"description": "Repo review policy",
"origin": "project-local",
"path": "/repo/.jcode/skills/repo-reviewer/SKILL.md",
"allowed_tools": null
},
{
"name": "karpathy-guidelines",
"description": "Skill description",
"origin": "built-in",
"path": "<builtin>/.jcode/skills/karpathy-guidelines/SKILL.md",
"allowed_tools": null
}
],
"policy": {
"policy_path": "/repo/.jcode/skills.scope.json",
"policy_exists": true,
"selected": [
{ "name": "repo-reviewer", "state": "visible", "explicit": true, "selected": true }
],
"skipped": [
{
"name": "optimization",
"state": "blocked",
"explicit": false,
"selected": false,
"reason": "state is blocked by project skill scope policy",
"policy_reason": "benchmark-only"
}
]
}
}Guarantees:
selectedpreserves router order: explicit--skillvalues first, followed by automatic matches.- Resolved entries use the shared skill entry shape after source precedence resolution.
- Missing explicit skills are reported as
{ "name": "...", "missing": true }instead of failing, so automation can decide whether to block. --cwdchanges repo-local skill resolution without requiring a provider call.policyrecords the repo-local scope-policy decision for every raw selected skill.
Command:
jcode-harness skills llmwiki-bridge --jsonShape:
{
"skill": "llmwiki-memory",
"kind": "local-mcp-bridge-preview",
"offline": true,
"network_required": false,
"permission_boundary": {
"default": "read-only preview; this command never invokes MCP tools",
"writes": "wiki_sync may write local raw/session pages only when the operator explicitly invokes it outside this preview",
"secrets": "do not record credentials, tokens, private keys, or unredacted personal data in wiki pages"
},
"commands": [
{
"name": "wiki_query",
"purpose": "Retrieve synthesized project memory, decisions, and prior context by question.",
"when_to_use": "Before planning or coding when prior decisions may exist.",
"mcp_tool": "mcp__llmwiki__wiki_query",
"example": { "question": "what did we decide about embedded skills?", "max_pages": 5 }
},
{
"name": "wiki_sync",
"purpose": "Import new local agent session transcripts into raw/sessions for future wiki use.",
"when_to_use": "At explicit memory-capture checkpoints after reviewing local write/secret boundaries.",
"mcp_tool": "mcp__llmwiki__wiki_sync",
"example": { "dry_run": true },
"write_risk": "local-files"
}
],
"recommended_flow": [
"Run wiki_query with the task question.",
"Use wiki_search for exact issue numbers or command names."
]
}Guarantees:
- This command is a deterministic offline preview and never invokes MCP tools itself.
offlineis alwaystrueandnetwork_requiredis alwaysfalsefor the preview command.- Every command entry includes
name,purpose,when_to_use,mcp_tool, andexample. - Commands that can write local files when invoked externally include an explicit
write_riskfield. permission_boundaryrecords the read/write/secret constraints that automation should surface before using the concrete MCP tools.
Command:
jcode-harness run "review this diff" --json --mock-response "ok"Shape:
{
"session_id": "session_...",
"provider": "harness-mock",
"model": "harness-mock-model",
"text": "ok",
"usage": {
"input_tokens": 1,
"output_tokens": 1,
"cache_read_input_tokens": null,
"cache_creation_input_tokens": null
}
}Guarantees:
textis the captured assistant response from the Agent runtime.usageis the last token usage snapshot known to the Agent.--mock-responseis offline and deterministic. Real providers may report different token counts or cache fields.
Command:
jcode-harness run "review this diff" --ndjson --mock-response "ok"Shape, one JSON object per line:
{"type":"start","session_id":"session_...","provider":"harness-mock","model":"harness-mock-model"}
{"type":"done","session_id":"session_...","text":"ok","usage":{"input_tokens":1,"output_tokens":1,"cache_read_input_tokens":null,"cache_creation_input_tokens":null}}Guarantees:
- The first event is
type: "start". - The terminal success event is
type: "done". - Future event types may be added between
startanddone; consumers should ignore unknown event types unless they opt into them.
- Additive fields are allowed.
- Removing or renaming fields requires a migration note and release-gate update.
- Consumers should tolerate unknown fields.
- Tests in
tests/e2e/harness_cli.rscover parseability and required fields for the current schemas.