Repository navigation
styles: output styles, chosen by name and switched with /style (#26 item 7) - #31
Merged
Merged
Conversation
) #26 item 7. An output style is a Markdown file whose body the agent is told to follow in every reply: .incode/styles/<name>.md, then ~/.incode/styles/<name>.md, the project's winning a clash; an optional front matter gives a `description`. None ships with incode. Which one: INCODE_OUTPUT_STYLE, else `output_style` in admin.json, else none (`off`/`none` say none). --admin shows it and its source, and says when no folder has that name; a session warns the same way rather than quietly running without it. A file over 64 KB, an empty one, an unknown front-matter key or a bad file name is left out and said. Where it goes: one block, pushed LAST in prepare_session (REPL and --acp) and in task_run (-t), so it reaches the API, claude, codex and agy routes. It says everything above it still holds: it shapes how replies read, never what the agent may do. budget_for_spawn keeps it as high priority when a long prompt is cut for a command line. /style lists the styles, /style <name> switches from the next reply, /style off stops: AgentSession::set_output_style takes the old block out of the standing context, puts the new one in and tells every backend through carry_context. /style is a REPL command. --acp dispatches built-in commands only from the OFFERED list in acp_agent/commands.rs, and this change does not add /style to it, so an ACP session keeps the style it started with. The README says so. Tests: discovery, precedence and descriptions; every kind of bad file reported; env over admin.json and off; a missing name is a warning; the block survives the command-line budget; a /style swap reaches the backend with exactly one style and the rest of the context kept. Controls: without the priority entry the style is cut; without the removal two styles are in force. `incode --admin` checked for a found, a missing and an `off` style.
…t be closed early From a security review of 754bc5c. Two holes, both through files a cloned repository can carry: - A symbolic link was followed. `.incode/styles/x.md` pointing at a key file would have put that file in the prompt sent to the model once `x` was chosen: read_dir used `path.is_file()`, which follows the link. It now reads `symlink_metadata` and refuses a link, in either folder, with a reported problem. - A repository could replace the operator's style. The project's folder was read first, so with `output_style: concise` and the operator's own ~/.incode/styles/concise.md, a repository's .incode/styles/concise.md won, and its text was told to the agent as "the person chose this". The operator's folder is now read first and wins a clash. Each style carries its Origin: the block says the text is "the person's own" or "this project's (from the repository)", /style shows yours / this project beside each, and --admin and the session note name the file. And a body can no longer end the block early: every `</output-style`, in any letter case, is written `< /output-style`, so only the block's own close remains. Tests: through load() itself (INCODE_DIR pointed at a temp folder), the operator's concise beats a repository's; a symlink to a secret is refused and reported (it ran here; Windows skips it without symlink rights); a body's closing tags leave exactly one close; the block names its origin. Controls: with the project read first, links followed, or the close not broken up, each of those three tests fails.
This was referenced Oct 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
#26 item 7. An output style is a Markdown file (
.incode/styles/<name>.md, then~/.incode/styles/<name>.md) whose body the agent follows in every reply. None ships with incode.INCODE_OUTPUT_STYLE, elseoutput_stylein admin.json;--adminshows it and its source, and a missing name is warned, never silently dropped.-t: one block, last in the prompt, saying the rules above it still win; kept as high priority when a prompt is cut for a command line./stylelists,/style <name>switches from the next reply,/style offstops (AgentSession::set_output_style→ every backend).--acp: ACP dispatches built-ins only fromOFFERED(acp_agent/commands.rs), which this change does not extend; an ACP session keeps the style it started with. Documented.Tests cover discovery and precedence, bad files reported, env over admin.json, a missing name warned, the budget keeping the block, and a swap reaching the backend with exactly one style. Controls: without the priority entry the style is cut; without the removal two styles are in force.
incode --adminchecked for found, missing andoff.Local (Windows): fmt clean; clippy only the existing
with_tool_serverwarning; bin 59 passed; lib 2183 passed, 1 failed: the desktop UIA live test, which walks whatever window has focus on this machine (a browser page here). It passed on CI's Windows runner in #30.