Repository navigation
Added
- Prompt caching for every model call, on by default. Sigil picks the method from the base URL
and model:cache_controlbreakpoints (Anthropic, OpenRouter Claude and Gemini, DashScope,
NanoGPT Claude),prompt_cache_key(OpenAI, Mistral, Together, Cerebras, DeepInfra, Kimi, and
servers with no documented scheme), session headers (xAI, Fireworks, OpenRouter), or nothing
where the provider caches on its own.SIGIL_PROMPT_CACHE(auto,on,off),
SIGIL_PROMPT_CACHE_TTL(1hby default,5m,24h) and thepromptCachesetting choose the
mode and lifetime for the main agent and all subagents. OpenAI'sprompt_cache_retentionis sent
only to the models OpenAI lists for it. See "Prompt caching" in the README. SIGIL_PROMPT_CACHE_PROVIDERnames the provider whose cache rules and prices apply to a server
Sigil does not recognise by its host, such as a local server on another port, a proxy or a
custom domain. A known host keeps its own rules. An unknown name is reported once and ignored.- Explicit context caches on the Gemini API and Vertex AI. When the published prices say it saves
money over Google's implicit caching, measured from recent replies, Sigil puts the system prompt
and tool list in acachedContentsresource, renews it while it is in use, and deletes it at
exit and at the end of a session. Caches left by a crashed run are deleted in the background at
the next start-up and at the first use of an endpoint, and only caches named with this install's
id are touched. A failed create, or a request that names a dead cache, goes out without the
cache. Only an error about the cache itself (403, 404, or a 400 that names it) drops it.
SIGIL_EXPLICIT_CACHEandSIGIL_EXPLICIT_CACHE_MAXcontrol it, and/cache list,
/cache deleteand/cache explicitmanage it. Storage cost appears in/cost,/stats, the
status line and OpenTelemetry, counts toward--max-budget-usdand background agents' cost, and
is saved with the session. - Vertex AI access tokens from
SIGIL_GOOGLE_TOKEN_COMMAND(for example
gcloud auth print-access-token), fetched again before they expire. The token used to be read
once from the key setting and stopped working after an hour. - Amazon Bedrock prompt caching. Claude and Nova models on a bedrock-runtime base URL, FIPS
endpoints (bedrock-runtime-fips.<region>.amazonaws.com) included, use the Converse API with
cachePointblocks on tools, system and messages, with 1h for Claude when the TTL is 1h. Nova
caches at most 20,000 tokens, so no Nova cache point is placed past that. Replies stream over
Bedrock's event stream and thinking blocks are kept for tool loops. The effort level reaches
Nova 2 models asreasoningConfig, and a JSON schema goes asoutputConfigstructured output.
A model that answers 400 to it gets the schema as an instruction instead. Auth is a Bedrock API
key (AWS_BEARER_TOKEN_BEDROCK) or AWS Signature Version 4 from the standard AWS variables or
~/.aws/credentials, using only the standard library.SIGIL_BEDROCK_CONVERSE=0keeps the
OpenAI-compatible endpoint. - Cache usage is read from each provider's own fields, among them DeepSeek's
prompt_cache_hit_tokens, DashScope cache writes, Together's top-levelcached_tokens,
SambaNova'scache_creation_tokens, and Fireworks'fireworks-cached-prompt-tokensheader and
perf_metricsin streamed replies. /cacheshows the hit rate and cache tokens and sets the mode or TTL for the session.
/cost,/usage,/stats, the status line JSON and OpenTelemetry records include cache reads,
writes, 1-hour writes and the hit rate. Sessions store 1-hour writes, and older sessions still
load.- Cache reads and 5-minute and 1-hour writes are priced with each provider's published ratio to
the input price: for example reads at 10% on Gemini, Vertex AI and SambaNova and 25% on Bedrock
Nova, and Nova writes at no charge. DeepSeek and Z.ai reads use the cache-hit prices on their
price pages. Gemini 3.6 and 3.8 Flash use the price Google lists for the day of the request (it
doubles on 2027-01-01).--cache-read-cost-per-million,--cache-write-cost-per-millionand
--cache-write-1h-cost-per-millionoverride these prices and are passed to background agents. - Model prices without flags. Sigil reads them from the server's model list where the server
publishes one (OpenRouter, NanoGPT), or from your own table in themodelPricessetting or
SIGIL_MODEL_PRICES(USD per million tokens:input,output,cache_read,cache_write,
cache_write_1h). Prices are looked up again after/model,/profile, a fallback model, a
subagent or background model, andagent-resume --model/--base-url, so each model is priced
as itself. A price set with a flag is kept. /costand/statshave a "Side calls" line, and the status line JSON has
cost.side_cost_usd. Side calls are model calls made outside the main loop, and their cost is
already part of the totals.background_agent_statusshows a finished background agent's input and output tokens and its
cache reads and writes next to its cost.- Hooks in the settings files are re-read on the next hook call after an edit. If a settings file
can't be read, the last good hooks stay in use.SIGIL_HOOKS_RELOAD=0turns this off. - Background agents can run on a different OpenAI-compatible endpoint from the main session. Pass
model: "name@base_url"or a separatebase_url. The key comes fromSIGIL_API_KEY_<HOST>
(for exampleSIGIL_API_KEY_NANO_GPT_COM). The main API key is never sent to another host, and
background_agent_startprints the endpoint it used. Abase_urlmust start withhttp://or
https://, and a model id that contains@but no URL is passed on unchanged. /mcp disableand/mcp enabletake effect from the next message, with no restart. A large server
stops costing its whole tool list at once, and the prompt cache is written again once. A refresh
that changes nothing sends the same tools in the same order, so the cache stays on every provider.
A server name that isn't configured, or one already in that state, says so and changes nothing.
Each change is logged with the server name and tool count only./loop <prompt>with no interval runs the prompt now and lets the agent pick when each next run
happens, from 1 minute to 1 hour, with the reason shown. The agent ends the loop with
schedule_wakeupwhen the task is done. A run that picks nothing gets one fallback run 20 minutes
later, and the loop ends if that run picks nothing too./loop every 10 minutes <prompt>works as
well as/loop 10m <prompt>.- Scheduled prompts are saved with their session and come back when it is resumed. Recurring prompts
older than 7 days, one-time prompts whose time passed while Sigil was closed, and a self-paced loop
whose next run came due while it was closed are not brought back, and Sigil says which ones and
why.SIGIL_LOOP_RESTORE=0restores nothing, andSIGIL_DISABLE_CRON=1turns scheduling off. - Scheduled prompts work with the prompt cache. A run due just as the cache would expire, like a
/loop 5mon a 5-minute cache, starts 15 seconds early so it still reads the cache. The cache
lifetime is worked out for the model in use at each run, so/modeland/profileare followed.
The agent is told how long the cache lasts after it picks a time, and the tool list never changes
while a loop runs. - Recurring prompts and loops end after 7 days, with one final run. A run that came due several
times while the agent was busy runs once.
Changed
- With an anthropic.com base URL, Sigil now uses the native Messages API by default because the
OpenAI-compatible endpoint does not cache prompts.SIGIL_ANTHROPIC_NATIVE=0keeps the old
behaviour. The native client now streams over server-sent events, andSIGIL_ANTHROPIC_STREAM=0
waits for the whole reply. - When a request gets HTTP 400 or 422 and the error names a cache field it carried, or is an
unknown-field error that names no other field, Sigil sends it once more without the cache
fields and sends that endpoint no cache fields for the rest of the session. Any other 400 or 422
is shown at once and not resent. Both cases are logged. /btw, compaction and rewind summaries send the main loop's own tools, system prompt and
messages plus one request message, so they read the conversation's prompt cache and don't write
a new entry.tool_choicestays as it is, since changing it would invalidate the cached
messages on Anthropic. The model is told not to call tools, a tool call in the reply is never
run, and a reply without text is asked for once more before Sigil falls back to the plain-text
transcript.- On servers that take
cache_controlmarkers in the OpenAI format, user, tool and system text is
always sent as one text part, so a message keeps the same bytes after its breakpoint moves on. - Microcompaction moved one old tool result per turn, which rewrote the cached prompt every turn.
While the cache is warm it now moves them in groups ofSIGIL_MICROCOMPACT_BATCH(default 3). - MCP tools are listed in a fixed order (server, then name), so the tool list at the start of
every prompt stays the same whatever order the servers answer in. - Each model call is priced when it is made, at the prices of the endpoint that answered. The cost
used to be recomputed every turn from the session's total tokens at the current prices. read_filewithallow_largereturns at most 240,000 characters (about 60k tokens), down
from 500,000. One full read of a large file could fill most of the context window.- The output one bash command keeps is still 10 times the tool output limit, but now stops at
240,000 characters when that limit is raised.SIGIL_BASH_STREAM_MAX_CHARSstill overrides it. - Sessions now record how they were started: in a chat, with
-p, or as a background agent.
/resume,sigil sessionsand a chat's-c/-rlist only your chat sessions, so a quick
-ptest no longer takes the place of the conversation you were working in. The list says how
many it hid, and/resume allorsigil sessions --allshows them. A text search
(/resume <text>,sigil sessions --search) still looks through every session. Sessions saved
before this change count as yours. A session file that can't be read stays in the list and the error is logged.
Fixed
- On Windows, a paste of several lines made while the agent is working stays one message with its
line breaks, and Enter sends it. It used to be sent as one message per line. A long paste also
shows up at once instead of one character at a time. - Text typed or pasted as a turn ends no longer starts a new turn by itself. Unsent text, the rest
of a paste that was still arriving, and messages queued too late for the turn wait in the input
box until you press Enter, and no characters are lost when a turn ends in the middle of a paste.
Ctrl+Enter still sends queued messages at once. Before, the start of such a paste was lost and
the rest was sent one line per turn. - Resuming a session printed the whole system prompt, the hidden session context and the runtime's own
notes as if you had typed them. The earlier conversation now shows only what you typed and what the
agent answered. - A comment after a value in a
.envfile (SIGIL_TRUST_ALL=1 # note) was read as part of the
value, so the setting did nothing. The three.envreaders now share one parser that follows
python-dotenv's rules. A#after a space starts a comment, a#with no space before it stays
part of the value (abc#def), quoted values keep everything inside the quotes, andexportis
allowed. Quotes around a value in the install folder's.envare now removed as well, as they
already were in a project's.env. - When folder trust left a folder's MCP servers out, the MCP tools said to add a
.sigil-mcp.json
although the file was there. They now name the servers that wait for folder trust and say to run
/trust grantand restart Sigil. The startup note and/statussay the same. - MCP servers from a folder that isn't trusted yet were left out without a word in what the model
was told, and a resumed session kept the MCP summary from when it started, so it could still list
servers that folder trust had since left out. The MCP summary,/mcpand/statusnow say how many
servers wait for folder trust (/trust grantloads them), and a resumed session gets a note with
the current MCP status when it changed. Server names from an untrusted project file reach the
model only as short plain labels. sigil sessionsopened the chosen session without asking the folder trust question, so a folder
that was never trusted ran with its hooks, MCP servers and env turned off and nothing said why. It
now asks like every other interactive start,-cand-rincluded. A launcher that builds the
agent itself can ask the same question withask_folder_trust(). A chat that starts before
the question was answered, or after the project items changed, now says its project items are off
and how to turn them on.- A long session on Claude 5.1 or later could stop with HTTP 400 "Invalid
signatureinthinkingblock. The block
is bound to a different conversation" and fail on every turn after it. Claude checks that nothing before a
replayed thinking block changed, and microcompaction, compaction and changed tools edit that part. Requests now
send thethinking-binding-controls-2026-08-01beta withblock_bindingset todrop_block, so the API leaves
such a block out. Where that can't be sent, Sigil removes the block the error names and every later one, sends
the request again once, and doesn't send those blocks again. Saved sessions that already hit the error continue
when resumed. Amazon Bedrock gets the same removal.SIGIL_THINKING_BINDING(drop,error,off) changes it. - Reasoning that other providers need back is now kept and sent back to the endpoint that wrote it. DeepSeek
(thinking mode with tools) and Kimi K3, K3.1 Pro and k2.7-code getreasoning_contenton assistant messages, and
Gemini 3 gets each tool call's thought signature inextra_content. When a step of tool calls came from another
model and has no signature, its first call carries Google'sskip_thought_signature_validatorvalue. If a server answers 400 asking for
reasoning_contentor thought signatures, the request is sent again with them, and if it refuses those fields,
again without them. Either choice holds for the rest of the session.SIGIL_REASONING_REPLAY(on,off)
overrides the automatic choice. - Provider detection matched host names by suffix, so
evilanthropic.comcounted as Anthropic.
It now needs the exact host or a subdomain. - After the first prompt of a REPL session, and after
-c/-r,/cost,/statsand the
status line counted the session's earlier usage and cost twice. agent-resumewithout--input-cost-per-million/--output-cost-per-millionset the
session's prices to 0, so resumed turns cost nothing. The stored prices are now kept.- Model calls outside the main loop were missing from
/cost,/stats, the status line and the
budgets:/btw, compaction, rewind summaries, theweb_fetchprompt,promptandagent
hooks, subagents, the architect's editor and the fast model. Each is now counted once, priced by
the model that served it, and kept in the session file, including in the backup a Ctrl+C writes. /compactreplaced the session's saved usage with a context estimate, so the token, cache and
cost totals reset after/compactand after resuming a compacted session. They are kept now.- Automatic compaction of a prompt that was too long counted the summary's tokens inside the
turn. It is now counted once, as a side call, at the price of the model that wrote it. - Usage from proxies that report
prompt_tokenstogether withcache_read_input_tokenscounted
cached tokens twice. /reload-pluginsdid not connectprompt,mcp_toolandagenthooks to the model, so those
hooks failed after a reload.skill_getand/reload-skillsnow find skills in~/.sigil/skills, parent folders,
.agents/skillsand--add-dirfolders. These skills were listed in the prompt but could
not be loaded.rollback_workspacereturns an error whengit reset --hardorgit clean -fdfails. It used
to report success.- A subagent run with
isolation: worktreethat made no changes now reports a failed
git worktree removeinstead of saying the worktree was removed. - On Windows, a hung
taskkillcan no longer block stopping a background agent or shell. Each
call times out after 10 seconds. - Output from git and other subprocesses is decoded as UTF-8 with replacement characters. A
non-ASCII file name ingit ls-filesused to crash the repo map on Windows code pages. - Saved sessions are read as UTF-8, so a session with non-ASCII text loads on Windows.
harbor_adapter.py, which runs Sigil in Harbor and Terminal-Bench, could not install Sigil on
current Debian, Ubuntu or Alpine images, which refuse a plainpip install, or where the image's
Python was older than 3.10. It now installs Sigil with uv in the agent user's folders, with its
own Python 3.12 when the image has none. A system prompt with spaces reached Sigil as separate
words, a task that started with-was read as a flag,--cwdbroke on a folder with spaces in
its name, and runs stopped after 12 turns. Runs now default to 100 turns, a version such as
1.1.0installs thev1.1.0tag, the same version already in the image is not installed again,
and the token totals and cost reach Harbor. Checked against Harbor 0.25.0.benchmarks/run.pyandbenchmarks/run_suite.pycrashed on Windows when their output went to a
file or a pipe. They write UTF-8 now.
Install: git clone https://github.com/X-AlphaCoder-X/sigil-code.git, then cd sigil-code and pip install -e .. See the README for the quick start.