Skip to content

armgit / Orkas

Public Imported from GitHub
0

Orkas is an open-source (MIT), local-first AI team for your desktop: a Commander turns your goal into to-dos and coordinates 16 built-in specialist agents plus Claude Code, Codex, OpenCode, OpenClaw and Hermes, with projects, scheduled automations and connectors. Free app for macOS & Windows; built-in models or your own keys.

Tighten per-skill edit chat sandbox to read-only on the skill dir

wyt3173ee75c27c
diff --git a/src/main/features/skills.ts b/src/main/features/skills.ts
index 5a767018..bc58c25f 100644
--- a/src/main/features/skills.ts
+++ b/src/main/features/skills.ts
@@ -1287,7 +1287,14 @@ export async function sendToSkillChat(userId: string, skillId: string, content:
const result = await chatWithModel({
userId, message: content, sessionId, systemPrompt,
agentName: 'orkas_chat', timeout: 300,
- ...(skill.dir ? { extraRoots: [skill.dir] } : {}),
+ // Read-only: the LLM in per-skill edit chat sees the skill dir for
+ // inspection (read_file / search_files / grep_files / stat_file), but
+ // every mutation goes through `<<<skill-file>>>` blocks parsed
+ // post-stream (which routes through `writeSkillFileForEdit` →
+ // rename-by-frontmatter / registry invalidation / progress events).
+ // Direct edit_file / write_file / bash on this dir would skip all
+ // that, so it's blocked at the sandbox level.
+ ...(skill.dir ? { readOnlyExtraRoots: [skill.dir] } : {}),
});
if (!result.ok) {
@@ -1370,7 +1377,7 @@ export async function* streamSendToSkillChat(
userId, message: content, sessionId, systemPrompt,
agentName: 'orkas_chat',
cacheRetention: 'short',
- ...(skill.dir ? { extraRoots: [skill.dir] } : {}),
+ ...(skill.dir ? { readOnlyExtraRoots: [skill.dir] } : {}),
...(opts.abortSignal ? { abortSignal: opts.abortSignal } : {}),
}) as AsyncIterable<any>) {
const etype = event.type;
diff --git a/src/main/prompts/chat_skill_setup.md b/src/main/prompts/chat_skill_setup.md
index 417febea..e2d1e88f 100644
--- a/src/main/prompts/chat_skill_setup.md
+++ b/src/main/prompts/chat_skill_setup.md
@@ -36,7 +36,7 @@ Rules:
- For turns that don't need to write files, do not output empty blocks.
- The block is hidden from the user's message, so **outside the block, write one or two sentences telling the user what you did**.
- **frontmatter has only three fields**: `name` + `description_zh` + `description_en`. Other fields (single-language `description` / `external_deps` / `requires` / `tags` / `version` etc.) are not written — at runtime the LLM picks the description matching the user's UI language; **both must be written** (writing only one means users in the other language see a blank entry in the list and may miss it). External dependencies go in a body section called "External dependencies".
-- **Skill files go ONLY through `<<<skill-file>>>`, never via the `write_file` tool** — `write_file` is for user workspace artifacts; bypassing the block skips skill rename / registry invalidation / progress events, and the filename will not match runtime expectations. To read content under the skill directory, use `read_file` / `search_files` / `grep_files` / `bash`; writing always goes through the block.
+- **Skill files go ONLY through `<<<skill-file>>>`, never via `write_file` / `edit_file` / `bash` (with redirects).** `write_file` is for user workspace artifacts; `edit_file` is for in-place text edits in the workspace; `bash >foo` / `bash sed -i` are shell-side mutations. Bypassing the block skips skill rename / registry invalidation / progress events, and the filename will not match runtime expectations. To read content under the skill directory, use `read_file` / `search_files` / `grep_files` / `bash` (read-only commands); writing always goes through the block. The sandbox now physically blocks direct mutation under `<skill_dir>`; the rule here keeps you from wasting a tool call probing it.
- **Cross-skill writes are no longer supported**: this session can only write into the current skill directory; do not try `<<<skill-file skill=...>>>` (deprecated).
## 3. Three creation modes