HagiCode.Libs is a lightweight .NET 10 library workspace for reusable HagiCode CLI integrations and repository exploration.
src/HagiCode.Libs.Core- transport, process management, executable discovery, and runtime environment resolution.src/HagiCode.Libs.Prompts- file-backed Handlebars prompt catalog loading, override merging, locale fallback, diagnostics, and rendering.src/HagiCode.Libs.Providers- provider abstractions, the Claude Code/Copilot/Codex/DeepAgents/Dsh/CodeBuddy/Gemini/Hermes/Junie/Kimi/Kiro/OpenCode/Omp/Pi/QoderCLI providers, and optional DI registration.src/HagiCode.Libs.Skills- skills-oriented infrastructure. Its first shipped capability is a typed online API client for search, well-known discovery, audit, telemetry, and GitHub metadata/tree requests.src/HagiCode.Libs.Imaging- in-process AVIF conversion (PNG, JPEG, WebP and GIF first frame to AVIF) with bundled libvips native libraries. Noffmpeg,avifencor other tool is used or looked up. Tests:tests/HagiCode.Libs.Imaging.Tests. Backend integration guide:docs/avif-backend-integration-guide.md.src/HagiCode.Libs.Git- typed Git client (IGitClient) for repository discovery and state inspection. Backend integration guide:docs/git-backend-integration-guide.md.tests/*- NUnit coverage for each project. Shared test settings, the NUnit and Shouldly packages and the global usings live intests/Directory.Build.props; each test project lists only its own references.
dotnet build HagiCode.Libs.slnx
dotnet test HagiCode.Libs.slnx
dotnet test tests/HagiCode.Libs.Imaging.Tests/HagiCode.Libs.Imaging.Tests.csproj # AVIF suite; native tests fail on supported platforms when the runtime cannot loadHagiCode.Libs.Skills is intentionally broader than the initial HTTP wrapper so future non-HTTP skills capabilities can ship in the same package without a rename. For now, the OnlineApi module is the delivered surface.
Register the package through DI:
using HagiCode.Libs.Skills;
using HagiCode.Libs.Skills.OnlineApi;
using HagiCode.Libs.Skills.OnlineApi.Models;
using Microsoft.Extensions.DependencyInjection;
var services = new ServiceCollection();
services.AddHagiCodeSkills(options =>
{
options.DisableTelemetry = true;
options.GitHubToken = "<token>";
});
await using var provider = services.BuildServiceProvider();
var onlineApiClient = provider.GetRequiredService<IOnlineApiClient>();Search and well-known discovery use typed request/response models:
var searchResponse = await onlineApiClient.SearchAsync(new SearchSkillsRequest
{
Query = "codex",
Limit = 10,
});
var discoveryResponse = await onlineApiClient.DiscoverWellKnownAsync(new WellKnownDiscoveryRequest
{
SourceUrl = "https://example.com/docs",
});The endpoint profile is provider-driven, so consumers can replace IOnlineApiEndpointProvider or override base URIs without changing the public client contract.
The DI registration path now exposes all built-in providers:
using HagiCode.Libs.Providers;
using HagiCode.Libs.Providers.ClaudeCode;
using HagiCode.Libs.Providers.Codebuddy;
using HagiCode.Libs.Providers.Copilot;
using HagiCode.Libs.Providers.Codex;
using HagiCode.Libs.Providers.DeepAgents;
using HagiCode.Libs.Providers.Gemini;
using HagiCode.Libs.Providers.Hermes;
using HagiCode.Libs.Providers.Kimi;
using HagiCode.Libs.Providers.Kiro;
using HagiCode.Libs.Providers.OpenCode;
using HagiCode.Libs.Providers.QoderCli;
using Microsoft.Extensions.DependencyInjection;
var services = new ServiceCollection();
services.AddHagiCodeLibs();
await using var provider = services.BuildServiceProvider();
var claude = provider.GetRequiredService<ICliProvider<ClaudeCodeOptions>>();
var codebuddy = provider.GetRequiredService<ICliProvider<CodebuddyOptions>>();
var copilot = provider.GetRequiredService<ICliProvider<CopilotOptions>>();
var codex = provider.GetRequiredService<ICodexProvider>();
var deepAgents = provider.GetRequiredService<ICliProvider<DeepAgentsOptions>>();
var gemini = provider.GetRequiredService<ICliProvider<GeminiOptions>>();
var hermes = provider.GetRequiredService<ICliProvider<HermesOptions>>();
var kimi = provider.GetRequiredService<ICliProvider<KimiOptions>>();
var kiro = provider.GetRequiredService<ICliProvider<KiroOptions>>();
var opencode = provider.GetRequiredService<ICliProvider<OpenCodeOptions>>();
var qoderCli = provider.GetRequiredService<ICliProvider<QoderCliOptions>>();OpenCode uses an HTTP runtime/session model instead of ACP. Consumers can attach to an existing runtime or launch a local opencode serve:
await foreach (var message in opencode.ExecuteAsync(
new OpenCodeOptions
{
WorkingDirectory = "/path/to/repo",
Model = "anthropic/claude-sonnet-4",
},
"Reply with exactly the word 'pong'"))
{
Console.WriteLine($"{message.Type}: {message.Content}");
}ProviderRegistry also exposes compatibility aliases so tests and higher-level factories share one naming surface:
claude-code->claude,claudecode,anthropic-claudecodebuddy->codebuddy-clihermes->hermes-cliopencode->open-code,opencode-cli
All CLI metadata is centralized in HagiCode.Libs.Core.Discovery.CliInstallRegistry. A repository test (CliInstallRegistryTests) fails when a package or pinned version in this table differs from the registry.
| Provider | npm Package | Pinned Version | CI-Covered |
|---|---|---|---|
| Claude Code | @anthropic-ai/claude-code |
2.1.168 | Yes |
| Copilot | @github/copilot |
1.0.114 | Yes |
| Codex | @openai/codex |
0.115.0 | Yes |
| OpenCode | @opencode/cli |
2.2.7 | Yes |
| CodeBuddy | (private) | — | No |
| Gemini | (local / explicit validation) | — | No |
| Hermes | (private) | — | No |
| Kimi | (local / explicit validation) | — | No |
| Pi | @earendil-works/pi-coding-agent (local / explicit validation, Node >=22.19.0) |
— | No |
| QoderCLI | (private) | — | No |
CliInstallRegistry now tracks OpenCode as a publicly installable CLI descriptor:
- npm package:
@opencode/cli@2.2.7(OpenCode 2.x; see "OpenCode 2.0 runtime compatibility") - executable candidates:
opencode - public installability:
true
The descriptor follows the OpenCode 2 install guidance (npm install -g @opencode/cli). The 1.x line stayed on the opencode-ai package name and is not supported.
HagiCode.Libs.Providers supports OpenCode 2.0 (fixtures were recorded against v2.0.32; the registry pins 2.2.7, which the fixtures have not yet been re-recorded for). OpenCode 1.x is no longer supported: its routes answer with the Web UI HTML shell and HTTP 200, which the provider reports as an unsupported API version instead of a JSON error.
- Owned runtime. The provider launches
opencode serve. OpenCode 2.0 printsserver listening on <url>andserver password <value>at startup; the provider accepts both lines, captures the password, and sends it as HTTP Basic credentials (usernameopencode) on every/api/*request. No setting is needed. - Attach mode. When
OpenCodeOptions.BaseUrlpoints at an externally managed runtime that requires a password, setOpenCodeOptions.ServerPassword. Without it, the health probe reportsauthentication failedin thehealth_probestage. - Password handling. The password is never returned in
CapturedOutput, lifecycleDiagnosticOutput, exception messages, or the runtime key (only a SHA-256 digest of an attach password takes part in the key).OpenCodeOptionsandOpenCodeStandaloneServerOptionsdo not print it inToString(). - Prompts. OpenCode 2.0 accepts the prompt as a queued inbox item. The assistant reply is assembled from
GET /api/event: a turn completes onsession.execution.succeeded, fails onsession.execution.failed, and its text comes fromsession.text.ended. The model is set on the session throughPOST /api/session/{id}/model, not on the prompt. - Inline files.
OpenCodeSessionPromptRequest.FromTextWithFiles(text, files)adds afilesarray to the prompt body, each entry{ "mime", "uri", "name" }withuriadata:<mime>;base64,…URL (OpenCodePromptFile). A request without files omitsfiles. OpenCode 2.0 rejects a bare string entry, aurlkey and a non-data URI with HTTP 400.ToString()prints lengths, counts and names only, never the data URL. - Model input capabilities.
OpenCodeHttpClient.ListModelsAsync()callsGET /api/modeland returnsOpenCodeModelInfoentries (ProviderId,Id,InputCapabilitiesfromcapabilities.input).AcceptsImageis true whenimageis listed. A model withoutcapabilitieshas no input capabilities. A failing listing throws only to its caller.
Note: the
CliInstallRegistrydescriptor pins@opencode/cli@2.2.7(see "OpenCode install metadata" above), the release line this runtime targets.
ClaudeCodeOptions.ThinkingDisplay is forwarded to the CLI as --thinking-display <mode>. Supported modes are summarized, omitted, and highlights (case-insensitive, surrounding whitespace ignored); any other value throws ArgumentException before a process starts. When unset or empty no flag is sent, so the CLI and model default applies. Current Claude models then stream thinking blocks with empty text, and summarized is what makes the text come back. Display only changes visibility; summaries cost the same tokens as omitted thinking.
--thinking-display is hidden from claude --help. If a CLI exits at launch with an unknown-option error for exactly that flag, before any stream message, the provider starts one replacement process with the same arguments minus the flag, and remembers the executable as unsupported until the host process restarts. Any other failure, and any failure after the first message, is surfaced once with no retry. The --settings argument is never inspected or rewritten: showThinkingSummaries is ignored by the CLI in --print / stream-json mode.
Verified with Claude Code 2.1.292 and 2.1.295: --thinking-display summarized returns thinking text and omitting the flag returns empty thinking text. Older builds are covered only by the fake-CLI fallback tests.
PiProvider runs pi --mode json --print and normalizes its JSONL stream into the shared CliMessage types. A request that sets PiOptions.UserInputHandler runs in Pi's RPC mode instead, so the agent can ask the user questions (see Interactive questions below).
- Package and runtime: the npm package is
@earendil-works/pi-coding-agent, which requires Node>=22.19.0. TheCliInstallRegistryentry records the package name but stays local-only (IsPubliclyInstallable = false, no pinned version). - Thinking levels:
PiOptions.Thinkingacceptsoff,minimal,low,medium,high,xhighandmax(case-insensitive) and forwards the value as--thinking. Any other value throwsArgumentExceptionbefore a process starts, and the message lists the valid values. - A provider needs a model: setting
PiOptions.ProviderwithoutPiOptions.Model(empty or whitespace counts as none) is a configuration error for every provider name. No process is started and the stream carries a singleterminal.failedthat names the provider, because Pi 1.x would exit with--provider requires --model. - Provider and model pass through as given: no gateway-specific prefix is added, stripped or defaulted. A selector saved for a retired gateway (for example
<gateway>/<id>) reaches the CLI unchanged and fails with the CLI's own error. Correct it by choosing a provider and model that the CLI already has configured; credentials from another provider setup are not copied. - Streaming formats: Pi 0.84 and later emit
message_updateevents that carry only the new fragment; earlier releases (0.78.x) carry a fullmessage/partialsnapshot. The provider recognizes the format per event, with no version probing. Incrementalassistantandassistant.thoughtmessages carrydelta: trueand contain only the new fragment, so a consumer appends them as they are: a whitespace-only fragment, or one equal to earlier text such asThe, is real content. Messages from the snapshot format carry nodeltamarker and are still reconciled against earlier text. Tool input arrives astool.callwhen Pi announces the call and astool.updatewith the complete arguments; partial argument JSON is never forwarded. - New or resumed session: the
sessionheader'stimestampis compared with the time the process was started. A header created by this run givessession.startedwithresumeMode: "started", an older one givessession.resumed, and an id different from the requested one givesrestarted. When the timestamp is missing or unreadable the provider falls back to comparing the returned id with the requested one. - Environment variables: nothing is set by default. To avoid network activity at startup pass
PI_OFFLINE=1,PI_SKIP_VERSION_CHECK=1andPI_TELEMETRY=0throughPiOptions.EnvironmentVariables. - Inline images (
PiOptions.Images): the default is empty, which changes nothing. A run that carries any image startspi --mode rpcwhether or not aUserInputHandleris set, with the same model, session, thinking and tool options as the print command, and sends each image in theimagesarray of the RPCpromptcommand as{ type: image, data: <base64>, mimeType }, in the order given. Image bytes stay in memory and never appear on the command line, in a file or inToString()/ JSON output (those show the media type and byte length). Without a handler the bundled question extension is not loaded and the question tool is not added to the allowlist; a dialog a user extension raises is declined. With every tool disabled (DisableAllTools) the run still uses RPC and sends the images, without the extension. A rejectedpromptends the run with Pi's diagnostic text; the provider does not retry without the images. If Pi refuses to start with the bundled extension because another extension registersask_user_question, a run that carries images continues in RPC mode without the extension, because print mode cannot carry images. Recorded frames from pi 1.4.0 are intests/HagiCode.Libs.Providers.Tests/Fixtures/Pi/rpc-image-*.jsonl. - Interactive questions (
PiOptions.UserInputHandler): the handler isnullby default and then nothing changes: the command line, the closed standard input, the completion on process exit and the absence of any extension are exactly what they were. JSON print mode has no UI, so a Pi that can ask must run in RPC mode. When a handler is set (andDisableAllToolsis off; with every tool disabled the handler is ignored and the print path runs) the provider startspi --mode rpcwith the same model, prompt, session, thinking and tool options, adds the bundledask_user_questionextension with-e(and adds the tool to a non-emptyAllowedToolsallowlist), and sends the prompt as an RPCpromptcommand instead of an argument. Because RPC output has no session header, the session id is read withget_stateand reported as the samesession.started/session.resumedmessage the print path produces (RPC cannot tell a session it just created under a requested id from an existing one, so a requested id that Pi reports back issession.resumed); the run ends on Pi'sagent_settledevent rather than on process exit, after which standard input is closed and the process is given 5 seconds to exit. Every other Pi event goes through the samePiJsonEventMapper, so text, thinking, tool and usage messages are identical on both paths. A prompt that Pi rejects (promptreply withsuccess: false) or an exit beforeagent_settledends the stream with aterminal.failedthat keeps Pi's error text, exit code and standard error. The extension is an embedded resource ofHagiCode.Libs.Providers, written once to<temp>/hagicode-libs/pi-extensions/<content hash>/ask-user-question.ts(temporary file, then move; an intact file is reused, so concurrent runs and upgrades agree) and needs no installation. It registersask_user_questionwith the input schema of Claude'sAskUserQuestion(questions[]withquestion,header,multiSelectandoptions[]oflabel/description). Pi's own dialogs cannot carry a header, option descriptions or a multi-select flag (selecttakes plain strings,ctx.ui.custom()is TUI only), so the whole question travels in oneinputdialog: the title is the wire markerhagicode:ask_user_question:v1, a newline and the JSON{ "toolCallId": "...", "questions": [ ... ] }; the answer is the JSON{ "answers": { "<question text>": "<answer>" } }in the dialog value, where a multi-select answer is one string with the values joined by a comma and a space and free text is passed through unchanged. A dialog with another marker version is not a question. When the dialog is cancelled, or the run is aborted (the extension hands Pi's abort signal to the dialog), the tool tells the agent that the user declined. The handler receives aPiUserInputRequest(the dialogRequestId, the agent'sToolCallIdand the questions with header,MultiSelectand option labels and descriptions) and returns aPiUserInputResponsewith the chosen labels or free text per question text. It runs in a background task, so the stream keeps flowing while a person thinks. Returningnull, throwing, orPiOptions.QuestionTimeout(default 30 minutes,Timeout.InfiniteTimeSpanfor no limit; any other non-positive value throwsArgumentOutOfRangeExceptionbefore a process starts) passing answers the dialog as cancelled, the agent is told the user declined and the run goes on to its normal result. Every dialog gets one response. Dialogs of other extensions (select,confirm,editor, aninputwithout the marker) are answered cancelled and never reach the handler; fire-and-forget UI requests (notify,setStatus,setWidget,setTitle,set_editor_text) are ignored. Pi has no tool timeout: an answer after more than 60 seconds worked end to end. The question is also yielded to the caller as anextension_ui_requeststream message, in the position it arrived, andPiUserInputRequest.TryFromCliMessagereads it back; the call and result of the question tool are ordinarytool.call/tool.update/tool.completedmessages, so a consumer that shows the question another way hides them (PiUserInputRequest.QuestionToolName). Callers that persist or parse every message of the stream must recognize theextension_ui_requesttype. Cancelling the call dismisses every open dialog, sends Pi anabort, closes standard input and, when Pi does not exit within the bound, stops the process; the call ends withOperationCanceledExceptionand no Pi process outlives it. Pi refuses to start (exit code 1, no output) when a user extension registersask_user_questionas well; the provider recognizes that, logs a warning through its optionalILogger<PiProvider>and runs the request in JSON print mode without questions.
OmpProvider runs omp --mode json --print and normalizes its JSONL stream into the shared CliMessage types. A request that sets OmpOptions.UserInputHandler runs in OMP's rpc-ui mode instead, so the agent can ask the user questions through OMP's built-in ask tool. Verified against omp 18.10.4.
- Interactive questions (
OmpOptions.UserInputHandler): the handler isnullby default and then nothing changes: the command line, the closed standard input and the completion on process exit are exactly what they were. When a handler is set (andDisableAllToolsis off; with every tool disabled the handler is ignored and the print path runs) the provider startsomp --mode rpc-uiwith the same model, system prompts, thinking,--resume/--no-session, tool and extra options, addsaskto a non-emptyAllowedToolsallowlist, and never passes--no-ui,--print, an extension or a positional prompt. Plain--mode rpchas noasktool. Before the prompt it runs a sequential handshake:{"type":"set_ask_dialog","enabled":true}(OMP's structured ask dialog is off by default for every process), thenget_state, whosedata.sessionIdis reported as the samesession.started/session.resumedmessage the print path produces, and only then the RPCpromptcommand. OMP answers a run withprompt_resultand ends it withsession_settled; background work (an asyncbashjob) can wake the agent after aprompt_resultwhosesessionSettledis false, so the provider keeps streaming untilsession_settled, then closes standard input and gives the process 5 seconds to exit.prompt_result.statusdecides the terminal message:completedgives the print path's completion,erroraterminal.failedwitherror.message(andprovider,model,http_status,retryable),abortedis described below. A prompt that OMP rejects, an exit beforesession_settledand output that is not JSON end the stream with aterminal.failedthat keeps the diagnostic text. Every other event goes through the sameOmpJsonEventMapper.rpc-uiattaches a message snapshot (message,assistantMessageEvent.partial) tomessage_updateevents that--mode jsondoes not send, serialized after later deltas already reached it, so fed as it is the mapper would repeat text; the provider removes it from text and thinking events (they reach the mapper exactly as on the print path) and keeps only thepartialof tool-call events, which gives the call its real id and tool name from its firsttool.call(the print path's delta-only stream starts with atool_callplaceholder untiltoolcall_end).ready,available_commands_updateand widget frames are ignored. Anaskrequest (extension_ui_requestwithmethod: "ask") becomes anOmpUserInputRequest:RequestIdis the frame id (unique peraskcall, stable for the run), and every question carries its OMPId, text,Header,MultiSelectand option labels and descriptions; OMP'spreview,recommendedand the frame'stimeoutare not passed on. The handler returns anOmpUserInputResponsewith the chosen labels or free text per question text, and the provider answers with one{id, selectedOptions, customInput?}per question, in request order. OMP rejects more than one option on a single-select question, an unknown label and a label selected twice (theasktool then fails), so a single-select answer selects a label only when the text equals an offered label (case-sensitive), a multi-select answer only when the text splits on", "into distinct offered labels (the longest label is tried first, so a label may contain a comma), and anything else is sent ascustomInputwith no selected option. The handler runs in a background task, so the stream keeps flowing while a person thinks. Returningnull, leaving a question without an answer, throwing, orOmpOptions.QuestionTimeout(default 30 minutes,Timeout.InfiniteTimeSpanfor no limit; any other non-positive value throwsArgumentOutOfRangeExceptionbefore a process starts) passing answers the request{"cancelled":true}. Unlike Claude and Pi, OMP then ends the run: the tool reportsAsk tool was cancelled by the userandprompt_result.statusisaborted, which the provider reports as a normalterminal.completedwithstop_reason: "aborted", not as a failure; an aborted run the host did not cause (neither a cancelled answer nor a caller cancellation) is aterminal.failedsaying OMP aborted the run. ThetimedOutmarker of OMP's schema is never sent, because OMP answers a timed-outaskwith the recommended (or first) options and lets the agent continue as if the user had chosen them. OMP has no ask timeout of its own (ask.timeoutdefaults to 0): an answer after more than 60 seconds worked end to end. Dialogs of extensions (select,confirm,input,editor) are answered cancelled and never reach the handler (they resolve toundefined/falseand the run goes on); fire-and-forget requests (notify,setStatus,setWidget,setTitle,set_editor_text,open_url) are ignored. Every dialog gets at most one response. The question is also yielded to the caller as anextension_ui_requeststream message, in the position it arrived, andOmpUserInputRequest.TryFromCliMessagereads it back; the call and result of theasktool are ordinarytool.call/tool.update/tool.completedmessages, so a consumer that shows the question another way hides them (OmpUserInputRequest.QuestionToolName). Cancelling the call sends OMPabortand nothing for an open question: OMP closes it with its own{"method":"cancel","targetId":...}frame (the provider cancels the handler's token and writes nothing), ends the runabortedand settles; the provider then closes standard input and stops the process when it does not exit within the bound, and the call ends withOperationCanceledException, so no OMP process outlives it. A build that answersset_ask_dialogwith a failure (one without the command) gets no prompt: the provider logs a warning with theomp --versionoutput through its optionalILogger<OmpProvider>, stops that process and runs the request in JSON print mode without questions. - Inline images (
OmpOptions.Images): the default is empty, which changes nothing. A run that carries any image always startsomp --mode rpc-ui(with or without a handler). The images go on the RPCpromptcommand asimages: [{"type":"image","data":<base64>,"mimeType":<media type>}], in order, and never on the command line or in a file. Without a handler (or withDisableAllTools) noset_ask_dialogis sent andaskis not added to the allowlist; the handshake starts atget_state, and anaskthe agent still raises is answered cancelled (the run endsaborted, a normal completion). A run with images whoseset_ask_dialogis rejected is not moved to JSON print mode, because that would drop the images: the samerpc-uicommand is started again without a handler and the images are sent. A rejectedpromptends the run as aterminal.failedwith OMP's diagnostic text.OmpImageAttachmentprints and serializes its media type and byte length only.
Built-in providers now participate in a shared pooling architecture:
- ACP providers (
CodeBuddy,Gemini,Hermes,Kimi,Kiro,QoderCLI) lease warm ACP sessions from the sharedCliProviderPoolCoordinator. Claude Codekeeps nativeSessionId/Resumecontinuity but always starts a fresh local CLI transport for each invocation and disposes it after the terminal message. Aresultis terminal only once no background subagent is still running and every started turn has produced itsresult; the turn that launches a background subagent ends with its ownresult, and the subagent's output plus the follow-up turn keep streaming afterwards. A subagent can also finish its turn while a background command or monitor it started (a task with aparent_task_id) is still running; the CLI resumes that subagent when the task ends, so the run stays open for it, bounded byClaudeCodeOptions.SubagentBackgroundWorkTimeout(default 20 minutes,Timeout.InfiniteTimeSpanfor no limit). Background work the main agent armed with a declared timeout is awaited too: aMonitor(timeout_ms) or aBashcommand run in the background with an explicittimeout. The agent ends its turn to wait for their events or exit, and closing the stream would kill them, so the run stays open until the task's own timeout plusClaudeCodeOptions.BackgroundWorkGracePeriod(default 1 minute) has passed, which the CLI enforces by ending the task. Both appear as plainlocal_bashtasks and are recognised by their tool call. A backgroundBashcommand with notimeoutis awaited as well, because an agent that starts a build this way and ends its turn to wait for it would otherwise lose the build and its notification when the stream closes; the CLI has no limit for such a command, so the bound is the host's,ClaudeCodeOptions.UntimedBackgroundCommandTimeout(default 30 minutes, counted from the command's start, without the grace period;Timeout.InfiniteTimeSpanfor no limit,TimeSpan.Zeroto never await it). A command meant to run for good, such as a dev server, therefore keeps the run open until that limit passes or the run is stopped. A subagent or background command that finishes while the main agent is still writing its final answer is reported mid-turn, but the CLI can only hand it to the agent by starting another turn right after theresult(it attaches notifications to the request after a tool result, and there is none left); the run therefore waits for that follow-up turn to start, bounded byClaudeCodeOptions.NotificationTurnTimeout(default 10 seconds), instead of closing the stream first. A notification that was already handed over (a tool result of the main agent follows it, or the CLI replayed it withorigin.kindtask-notification) needs no follow-up turn. While a run waits,ClaudeCodeProvideralso yields syntheticagent_work_snapshotmessages (HagiCode.Libs.Core.AgentWork.AgentWorkSnapshot, read back withAgentWorkSnapshot.TryFromCliMessage) that tell the caller what the host is waiting on. Each snapshot is the complete item list: asubagentfor everylocal_agenttask, and amonitorfor aMonitor, a timed backgroundBashcommand, or any task a subagent owns (nested under its subagent throughparentId). An item carries its title, a truncated command, its start anddeadlineAt, the subagent's final summary, andblocksCompletion, which is true exactly while the completion tracker keeps the run open for it. A snapshot is placed right after the CLI message that changed it, at most one per message and only on change; it holds no raw CLI JSON and never alters when the run completes. Status events for a task that never started in the run (a resumed session replays stopped notifications of its old tasks) create no item. Callers that persist or parse every message of the stream must recognize the type and skip it.ClaudeCodeOptions.UserInputHandlerlets the agent ask the user questions during a run. It isnullby default and then nothing changes. When it is set, the provider adds--permission-prompt-tool stdioto the CLI arguments, which makes the CLI registerAskUserQuestionand send its permission prompts to the host ascontrol_requestmessages. AnAskUserQuestionrequest (ClaudeUserInputRequest: request and tool-use ids, questions with header, options andmultiSelect, and the original input) is passed to the handler in a background task, so the stream keeps flowing while the question is pending. The handler returns aClaudeUserInputResponsewith the chosen option labels or free text for each question text; the provider writescontrol_responseallowwithupdatedInputequal to the original input plus ananswersobject, and joins the values of a multi-select question with a comma and a space. Returningnull, a handler that throws,ClaudeCodeOptions.QuestionTimeout(default 30 minutes,Timeout.InfiniteTimeSpanfor no limit) passing, or a caller cancellation answerdenywith a message, so the CLI reports the call underpermission_denialsand the run still reaches its normal result (a cancellation ends the stream withOperationCanceledExceptionas before, after a best-effort deny). While a question is pending the other wait bounds (PromptStartTimeout,SubagentBackgroundWorkTimeout, the monitor deadline plusBackgroundWorkGracePeriod) do not end the run; they apply again once it is resolved. Every othercan_use_toolrequest is denied at once with a fixed message and never reaches the handler, which is what the CLI does today for a tool its permission mode does not approve. The CLI echoes the host's owncontrol_responseon stdout; the provider drops that echo. The request is identified by the tool name because CLI 2.1.159 does not sendrequires_user_interaction, which 2.1.292 does. The interactive request is also yielded to the caller as acontrol_requeststream message, in the position it arrived and after the output that preceded it, andClaudeUserInputRequest.TryFromCliMessagereads it back. Likeagent_work_snapshot, callers that persist or parse every message of the stream must recognize the type and skip or handle it; requests the provider answers itself are not passed on.Codexruns each request in a fresh local CLI process. Resume continuity depends on an explicitThreadId; there is no Codex-specific runtime pooling.Copilotdoes not participate in the shared runtime pool. Each invocation creates a fresh SDK runtime, and continuity depends only on provider-nativeSessionIdresume semantics.
Providers that actually participate in pooling expose PoolSettings so callers can disable pooling or tune provider-level behavior. ClaudeCodeOptions intentionally does not expose provider-level pool controls anymore:
var options = new CodebuddyOptions
{
SessionId = "demo-session",
WorkingDirectory = "/path/to/repo",
PoolSettings = new CliPoolSettings
{
Enabled = true,
IdleTimeout = TimeSpan.FromMinutes(15),
MaxActiveSessions = 50,
KeepAnonymousSessions = false
}
};Operational notes:
- Warm reuse only occurs when the logical session key and compatibility fingerprint still match.
- Each pooled entry executes one prompt at a time through an execution lock.
- Idle entries are reaped before capacity failures are reported; if a provider is still full after TTL cleanup, the oldest idle entry is evicted next.
- Faulted transports and broken ACP sessions are removed immediately instead of being returned to the pool.
CliAcpSessionPool.GetDiagnosticsSnapshot()now reports global plus provider-scoped hit/miss/evict/fault counters, along with the latest eviction/fault reason; the pool also emits structured logs andSystem.Diagnostics.Metricscounters for monitoring hooks.- Default ACP idle TTL baselines remain provider-specific:
codebuddy/deepagents/gemini/kimi/kiro/qodercli=10mandhermes=24h.claude-code,codex,copilot, andopencodedo not register shared local-runtime TTL entries. - Hosts can enable
CliProcessOwnershipOptionsto persist managed subprocess PID ownership. The ledger, snapshots, termination and Windows containment built on it are described in Process ownership, snapshots and termination.
CodeBuddy execution options cover the ACP-specific runtime settings without forcing raw command lines:
var options = new CodebuddyOptions
{
Model = "glm-4.7",
WorkingDirectory = "/path/to/repo",
SessionId = "codebuddy-session-123",
ModeId = "plan",
EnvironmentVariables = new Dictionary<string, string?>
{
["CODEBUDDY_TOKEN"] = "<token>"
}
};
await foreach (var message in codebuddy.ExecuteAsync(options, "Reply with exactly the word 'pong'"))
{
Console.WriteLine($"{message.Type}: {message.Content}");
}SessionId hits a compatible session in the shared ACP pool; ModeId is sent again after session/new or warm reuse so the permission and execution mode stay aligned with the caller's request.
Copilot execution options cover SDK-managed session startup without exposing raw prompt-mode wiring. Unsupported startup flags are filtered before launch, while compatible flags remain available through AdditionalArgs:
var options = new CopilotOptions
{
Model = "claude-sonnet-4.5",
WorkingDirectory = "/path/to/repo",
SessionId = "copilot-session-123",
Permissions = new CopilotPermissionOptions
{
AllowAllTools = true,
AllowedPaths = ["/path/to/repo"]
},
AdditionalArgs = ["--config-dir", "/path/to/.copilot"]
};
await foreach (var message in copilot.ExecuteAsync(options, "Reply with exactly the word 'pong'"))
{
Console.WriteLine($"{message.Type}: {message.Content}");
}Set SessionId when you want provider-native Copilot resume semantics. The provider first attempts SDK resume for that id, falls back to creating a new session pinned to the requested id when nothing persisted yet, and emits session.started or session.resumed messages accordingly. Requests without SessionId stay anonymous and still create a fresh SDK runtime on every attempt. Legacy PoolSettings values are ignored for compatibility.
Copilot image attachments are passed in CopilotOptions.Images as CopilotImageAttachment values (media type, bytes and an optional file name). The list is empty by default, and an empty list leaves the send unchanged. The images travel as inline UserMessageAttachmentBlob entries on the one SendAndWaitAsync call of a run, whether the session is fresh, resumed, or created after a failed resume. Session creation and resume configuration never carry images.
CopilotProvidervalidates every image before any SDK client or process starts. A null entry, empty data, or a media type that does not start withimage/throws anInvalidOperationExceptionthat names the position and the media type, never the bytes.CopilotImageAttachmentandCopilotOptionsprint and serialize only the media type, file name, byte length and image count. The base64 string exists only for the SDK call.- Each
user.messageecho or other raw event is serialized with image blob data replaced by a fixed marker that keeps the length, so the base64 string never reaches a raw event'sContent. ICopilotModelCapabilityReader.GetImageCapabilityAsync(options, model)reads a model's image capability from the SDK model list.CopilotProviderimplements it andAddHagiCodeLibs()registers it. It returnsCopilotModelImageCapability(SupportsVision,MaxPromptImages,MaxPromptImageSize,SupportedMediaTypes), where a limit Copilot does not report, or reports as zero or negative, isnull. It returnsnull(unknown) when no model is given, the model is not listed, its vision entry is missing, or the list cannot be read. The read starts a short-lived client and disposes it on every path; only cancellation of the caller's token is thrown.
Codex execution options cover the common CLI settings without forcing raw command lines:
var options = new CodexSessionOptions
{
ThreadOptions = new ThreadOptions
{
Model = "gpt-5-codex",
SandboxMode = SandboxMode.WorkspaceWrite,
ApprovalPolicy = ApprovalMode.Never,
WorkingDirectory = "/path/to/repo",
AdditionalDirectories = ["/path/to/repo"],
SkipGitRepoCheck = true,
}
};
await using var codexSession = await codex.CreateSessionAsync(options);
var result = await codexSession.Thread.RunAsync("Reply with exactly the word 'pong'");
Console.WriteLine(result.FinalResponse);For Codex sessions, pass a stable CodexSessionOptions.ThreadId when you want to resume a previous conversation. Requests without ThreadId stay anonymous and always start a fresh local CLI process.
Hermes execution options cover the managed hermes acp bootstrap path without forcing raw process wiring. SessionId is treated as an in-memory conversation key for the current provider instance, rather than a cross-process resume token:
var options = new HermesOptions
{
Model = "hermes/default",
WorkingDirectory = "/path/to/repo",
SessionId = "hermes-session-123",
ModeId = "bypassPermissions",
Arguments = ["acp"],
EnvironmentVariables = new Dictionary<string, string?>
{
["HERMES_TOKEN"] = "<token>"
}
};
await foreach (var message in hermes.ExecuteAsync(options, "Reply with exactly the word 'pong'"))
{
Console.WriteLine($"{message.Type}: {message.Content}");
}Hermes SessionId still means a session reuse key within the current provider instance; ModeId takes part in the shared pool fingerprint and is re-applied after an ACP session is created or reused.
Gemini execution options cover ACP bootstrap, optional authentication, and session/load resume without forcing consumers to handcraft JSON-RPC calls:
var options = new GeminiOptions
{
WorkingDirectory = "/path/to/repo",
Model = "gemini-2.5-pro",
AuthenticationMethod = "token",
AuthenticationToken = "<token>",
AuthenticationInfo = new Dictionary<string, string?>
{
["region"] = "global"
},
ExtraArguments = ["--profile", "smoke"]
};
await foreach (var message in gemini.ExecuteAsync(options, "Reply with exactly the word 'pong'"))
{
Console.WriteLine($"{message.Type}: {message.Content}");
}Kimi execution options cover ACP bootstrap, optional authentication, and session/load resume without forcing consumers to handcraft JSON-RPC calls:
var options = new KimiOptions
{
WorkingDirectory = "/path/to/repo",
Model = "kimi-k2.5",
AuthenticationMethod = "token",
AuthenticationToken = "<token>",
AuthenticationInfo = new Dictionary<string, string?>
{
["region"] = "cn"
},
ExtraArguments = ["--profile", "smoke"]
};
await foreach (var message in kimi.ExecuteAsync(options, "Reply with exactly the word 'pong'"))
{
Console.WriteLine($"{message.Type}: {message.Content}");
}Kiro execution options cover the shared ACP bootstrap path with optional authentication and custom bootstrap overrides:
var options = new KiroOptions
{
Model = "kiro-default",
WorkingDirectory = "/path/to/repo",
AuthenticationMethod = "token",
AuthenticationToken = "<token>",
ExtraArguments = ["--profile", "smoke"]
};
await foreach (var message in kiro.ExecuteAsync(options, "Reply with exactly the word 'pong'"))
{
Console.WriteLine($"{message.Type}: {message.Content}");
}If initialize advertises auth methods, the provider performs authenticate before creating the session. PingAsync() intentionally reports that state as a local-validation requirement instead of assuming credentials are available in public CI.
QoderCLI execution options mirror the ACP stdio providers while keeping the model override optional. SessionId is forwarded to the session/new or session/resume ACP call when present, and ExtraArguments are appended after the managed --acp bootstrap switch:
var options = new QoderCliOptions
{
WorkingDirectory = "/path/to/repo",
Model = "qoder-max",
EnvironmentVariables = new Dictionary<string, string?>
{
["QODERCLI_TOKEN"] = "<token>"
},
ExtraArguments = ["--profile", "smoke"]
};
await foreach (var message in qoderCli.ExecuteAsync(options, "Reply with exactly the word 'pong'"))
{
Console.WriteLine($"{message.Type}: {message.Content}");
}If you omit Model, the provider forwards no model override so qodercli can use its own default. This keeps the integration aligned with local qodercli installations whose supported model names may vary by environment. The provider also forces each ACP session into yolo mode after session/new or session/load, so unattended prompts can use tool and file-system callbacks without interactive permission gates.
An agent CLI and the commands it starts can be capped at a memory limit, a CPU limit, or both. When a limit is active, CliProcessManager and the launchers that build their own start information (Codex exec, the Codex app-server and OpenCode, through CgroupScopeLauncher) start the CLI inside a systemd user scope. The scope charges the agent and every process it starts. systemd-run --scope replaces itself with the CLI, so the tracked process id, the standard streams and the exit code are the CLI's, and ProcessResult.ResolvedExecutablePath and CommandPreview still name the CLI.
The limits come from ICliResourceLimitProvider. AddHagiCodeLibs() registers EnvironmentCliResourceLimitProvider with TryAddSingleton. It reads two independent variables on every launch:
AGENT_MEM_MAX: a positive whole number with an optionalM,MB,GorGBsuffix (case-insensitive, megabytes by default).AGENT_CPU_MAX: a positive whole number of percent of one core, with an optional%suffix.200%and200both mean two cores. A value above10000is clamped to10000.
An empty, zero or negative value means no limit for that resource. A malformed value also means no limit for it and logs one warning for that variable. A host that keeps its own setting registers its provider with Replace, and then neither variable is read. new CliProcessManager() has no provider and never applies a limit. Limits are read for each launch, so a change applies to agents started afterwards.
Every memory value is derived from the memory limit in whole megabytes, rounded down:
| Property | Value |
|---|---|
MemoryMax |
the memory limit |
MemoryHigh |
85% of the memory limit |
MemorySwapMax |
0 |
TasksMax |
2000 |
NODE_OPTIONS |
adds --max-old-space-size= 75% of the memory limit; other content is kept, and a caller's own --max-old-space-size wins |
CPUQuota |
the CPU limit as a percentage of one core (CPUQuota=200% is two cores); CPUWeight is not used |
For example, these settings:
AGENT_MEM_MAX=4G
AGENT_CPU_MAX=200%start each agent CLI as:
systemd-run --user --scope --quiet -p MemoryMax=4096M -p MemoryHigh=3481M -p MemorySwapMax=0 -p TasksMax=2000 -p CPUQuota=200% -- <cli> <args>
NODE_OPTIONS=--max-old-space-size=3072
With AGENT_CPU_MAX alone, the scope carries only -p CPUQuota=200%, and NODE_OPTIONS is not set. With AGENT_MEM_MAX alone, the scope carries only the memory properties.
Requirements: Linux with cgroup v2, systemd-run on PATH, and a running systemd user manager that the process can reach (XDG_RUNTIME_DIR or DBUS_SESSION_BUS_ADDRESS must be set). CgroupScopeCapabilityProbe checks memory once per process with a trial systemd-run --user --scope --quiet -p MemoryMax=64M -- true (5 s timeout) and reports ok, not-linux, systemd-run-missing or user-scope-unavailable. It checks CPU with a trial -p CPUQuota=50% scope and reads that scope's own cpu.max. CPU is reported ok only when the quota reads back as limited. A scope whose cpu.max reads max or cannot be read reports cpu-controller-unavailable, which means the cpu controller is not delegated to the user manager. The probe never spawns anything on Windows or macOS.
Memory and CPU are decided separately. A limit the host can enforce still applies when the other cannot be enforced, and the agent starts without the unenforceable part. One warning is logged per resource and reason.
Version probes, discovery and CI setup set ProcessStartContext.ApplyResourceLimits = false (or CliExecutionRequest.ApplyResourceLimits = false) and are never limited.
CliProcessManager can tell which agent CLI processes it owns, read their process trees, and end them safely. Every process is identified by a ProcessIdentity: its process id and its start time in UTC. A process id alone is not enough, because the operating system reuses ids. Every identity check allows CliProcessOwnershipOptions.StartTimeTolerance (default one second) between the recorded and the live start time.
Platform support:
| Platform | Process table and details | Termination | Windows Job containment |
|---|---|---|---|
| Linux | /proc. Verified by the Core unit and integration tests. |
Process.Kill on the single pid, after an identity check |
Not applicable |
| Windows | Toolhelp and OpenProcess. Implemented; the Job Object path is covered by control-flow tests that run on Linux with a fake Job factory. Not yet verified on a Windows host. |
TerminateProcess on the single pid, or TerminateJobObject for contained trees |
Implemented; see below |
| macOS | ps with LC_ALL=C and TZ=UTC. Parser tests run on recorded ps output. Not verified on a macOS host. |
Process.Kill on the single pid |
Not applicable |
Other platforms throw PlatformNotSupportedException from the snapshot and termination calls.
The ledger is an in-memory record of processes that are alive now. It is separate from the JSON state file, and the state file format is unchanged. The ledger is kept whether or not persistence is enabled; only the state file depends on CliProcessOwnershipOptions persistence. Pass one CliManagedProcessLedger to several managers to give them a shared view; without one, each manager keeps its own.
StartAsyncadds a process to the ledger whenProcessStartContext.Ownershipis set. The origin isCliManagedProcessOrigin.Started.CliProcessOwnershipRegistration.SessionIdnames the session that owns the process. It is kept in memory for queries and is not written to the state file.- The provider adapters pass
options.SessionIdfor every agent launch. Version probes andPingAsyncchecks carry no session and are not tracked. Copilot and OpenCode do not use ownership, so their processes are not tracked. - Disposing the handle, or calling
StopAsync, removes the entry.CliProcessHandlecachesPid,StartedAtUtcandIdentityright after the process starts, so they stay readable after the process exits or itsProcessis disposed. GetAliveManagedProcesses(query)returns only the entries that are still alive with the same start time. It removes the entries that have exited or whose id was reused. Each result is aCliManagedProcessInfo, with itsIdentity,ProviderName,SessionId,ExecutablePath,WorkingDirectory,Origin(CliManagedProcessOrigin) andIsContained.
var alive = manager.GetAliveManagedProcesses(new CliManagedProcessQuery { ProviderName = "claude-code", SessionId = sessionId });A host that starts its own process, for example an ACP runtime, can register it so it appears in the ledger and the state file:
var process = System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo("claude") { UseShellExecute = false })!;
await using var registration = await manager.RegisterExternalProcessAsync(
process,
new CliExternalProcessRequest { ProviderName = "claude-code", SessionId = sessionId, WorkingDirectory = workingDirectory });
// Later: find the session's processes and end one of them by identity.
var alive = manager.GetAliveManagedProcesses(new CliManagedProcessQuery { SessionId = sessionId });
var result = await manager.TerminateProcessTreeAsync(alive[0].Identity);Disposing the CliExternalProcessRegistration removes the ledger entry and the persisted record. It does not stop the process. RegisterExternalProcessAsync throws InvalidOperationException when the process has already exited or its start time cannot be read.
CaptureManagedProcessTreesAsync(query, options) reads the process table once for all matching managed processes and returns one CliManagedProcessTree per process, pairing the ledger entry with its ProcessTreeRootSnapshot. ProcessTreeSnapshotter.CaptureAsync does the same for any identities you supply.
The snapshot types are: IProcessTreeSnapshotter, the capture interface; ProcessTreeSnapshotRequest, which names the roots and the ProcessTreeSnapshotOptions; ProcessTreeSnapshot, which holds one ProcessTreeRootSnapshot per requested root in request order; ProcessTreeRootStatus (Found, NotFound or IdentityMismatch) on each root; and ProcessSnapshotEntry, one per listed process, which carries ProcessMembership (Root or Descendant) and ProcessAccessibility.
- Entries are listed parent before child, with a
Depthof 0 for the root. Members are listed at depth 1 and beyond. - A root reports
ProcessTreeRootStatus.Found,NotFound(no such process) orIdentityMismatch(the id now belongs to a different process). OnlyFoundlists entries. ProcessSnapshotEntry.AccessibilityisAccessible,Partial(for example, the command line could not be read) orDenied. ADeniedentry has noStartedAtUtc, so it cannot be turned into a termination request.ProcessTreeSnapshotOptions.MaxProcessesPerRoot(default 512) bounds the walk and setsTruncated.TimeoutthrowsTimeoutException.IncludeCommandLinedefaults totrue. Command lines can contain secrets, so set it tofalseto skip the read entirely. The snapshot never redacts them.- Each entry's
Accessibility(ProcessAccessibility) says how much was read:Accessible(every field),Partial(the process was listed, but some details such as the command line were withheld), orDenied(the operating system refused the detail read, so its start time and identity are unknown and it is not used for termination). - A child that started more than
StartTimeTolerancebefore its parent is not followed. Its parent link is treated as stale, because the parent's id was reused. ProcessCpuUsage.CalculatePercentOfOneProcessorandCalculatePercentOfHostderive a percentage from two snapshots of the same process. They returnnullwhen either sample is missing, the CPU time is unavailable, the process was replaced, or the clock did not advance.CalculatePercentOfHostdivides the same delta by the logical processor count you pass.
var trees = await manager.CaptureManagedProcessTreesAsync(new CliManagedProcessQuery { SessionId = sessionId });
foreach (var tree in trees)
{
foreach (var entry in tree.Tree.Processes)
{
Console.WriteLine($"{new string(' ', entry.Depth * 2)}{entry.Pid} {entry.Name}");
}
}TerminateProcessAsync(identity, options) ends one process. TerminateProcessTreeAsync(identity, options) ends a process and its descendants. CliProcessTerminator provides the same two calls without a manager.
Every call first checks the root's identity, so a reused id ends nothing. The tree walk then re-checks each descendant's identity immediately before its kill, and it kills leaves first, so a parent cannot respawn a child that has already been killed. CliProcessTerminationOptions.ExitWaitTimeout (default five seconds) bounds how long each killed process gets to exit.
The identity check and the kill are separate system calls. The check runs immediately before each kill, which keeps the window small, but an id that is reused in the moment between the two cannot be ruled out. A Terminated result is therefore best effort for a process id that might be reused, not a guarantee.
Results are typed. CliProcessTerminationResult.Outcome is one of:
| Outcome | Meaning |
|---|---|
Terminated |
The process (or every process in the tree) is gone. Descendants that were already gone or whose id was reused count as ended. |
AlreadyExited |
No process with this identity was running when the call started. Nothing was killed. |
AccessDenied |
The operating system refused the kill, or the start time could not be read, so the identity cannot be verified. Nothing was killed. |
IdentityMismatch |
A different process now has this id. Nothing was killed. |
PartiallyTerminated |
The root ended, but at least one descendant could not be ended (AccessDenied or Failed). |
Failed |
The process did not exit within ExitWaitTimeout, or the kill failed for another reason. |
CliProcessTerminationResult.Method (a CliProcessTerminationMethod) is Single (one process), TreeWalk (the tree was walked and each process was killed), or Containment (a Windows Job ended the members, see below). Items lists one CliProcessTerminationItem per process attempted or checked, with the identity it was checked against.
TerminateProcessAsync and TerminateProcessTreeAsync never throw for an expected case. Only OperationCanceledException escapes, and only when the token is already cancelled before work starts.
RecoverOwnedProcessesAsync uses TerminateProcessTreeAsync for each persisted record, logs the outcome, and removes the record in every case. A record whose identity no longer matches is skipped.
On Windows, a launch with ProcessStartContext.Ownership set, and an external registration, is placed in a Job Object so that the Job can end the whole tree:
- The Job is created before the process starts, and the process is assigned right after
Start(). Any child that was spawned in that short window is swept into the Job. - The Job is created with
KILL_ON_JOB_CLOSE. This is a behavior change for an agent CLI that deliberately leaves a background daemon after its command finishes. Stopping the handle, or disposing it, now ends that daemon as well. SetCliProcessOwnershipOptions.WindowsJobContainmenttofalseto restore the previous behavior. The switch defaults totrue. - Any failure to create, configure or assign the Job logs a warning with the Win32 error code. The process is then not contained (
IsContainedisfalse), and the existingKill(entireProcessTree: true)path stays in force. The launch does not fail. - Disposing an external registration only removes the Job's kill-on-close limit and releases the handle. It does not end the members, because the process must keep running after its registration is disposed.
- Contained processes do not depend on recovery after a host crash. If the host dies, Windows closes the Job handle and ends the members. A new host's
RecoverOwnedProcessesAsyncfinds nothing for them. TerminateProcessTreeAsyncon a contained process ends the Job's members even after the root has exited, so an orphaned descendant is still ended. A root whose identity check fails for any other reason (a reused pid, for example) ends nothing.
Verified on an unpackaged Windows 11 host (build 26200, .NET 10.0.404, 2026-11-22). The WindowsOnly live tests pass: a Job is created, assigned and terminated; a descendant that outlives its exited parent is gone after stop; an orphan is ended by TerminateProcessTreeAsync through the Job; and WindowsProcessPlatform reads every field of a live child. In a measurement where a launcher started eight children as its first action, all eight were inside the Job and none escaped. The window between Start() and assignment was not timed separately. In the same environment, a grandchild started through Start-Process (which uses ShellExecute) was not inherited into the Job, while one started with Process.Start and UseShellExecute = false was, so containment does not reach processes created through ShellExecute. The cause of that difference was inferred, not isolated. The full Core test project fails the same 88 tests on the host with and without this change; they need /bin/sh or Unix file modes. The fallback and access-denied paths are covered on Windows only through fake-platform tests. A packaged (MSIX) run and a real Medium-IL access-denied check have not been performed.
- AVIF conversion:
docs/avif-backend-integration-guide.md - Git backend:
docs/git-backend-integration-guide.md - Skills online API:
docs/skills-online-api-reference.md - CLI discovery:
docs/agent-cli-discovery-guide.md
- Zero heavy framework dependencies in the reusable libraries.
- Cross-platform CLI process management for Windows, macOS, and Linux.
- Stream-oriented provider integrations that can power higher-level HagiCode tools.
- Simple provider registration for DI and non-DI consumers.