From 2660b70172bb2f6eed8d47de61a305602c9b2414 Mon Sep 17 00:00:00 2001 From: xmv97 Date: Wed, 17 Jun 2026 12:05:56 +0000 Subject: [PATCH 1/2] feat(task): use ${HOME} placeholder in agent resource paths Allow the agent to run as a non-root user by replacing the hardcoded /tmp/codingmatrix-project-tpl base with ${HOME}/.codingmatrix/project-tpl. The agent expands the env var at runtime via os.ExpandEnv. Co-Authored-By: Claude Opus 4.6 (1M context) --- backend/biz/task/usecase/task.go | 6 +++--- backend/templates/opencode.tmpl | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/backend/biz/task/usecase/task.go b/backend/biz/task/usecase/task.go index c23d947b..d385c992 100644 --- a/backend/biz/task/usecase/task.go +++ b/backend/biz/task/usecase/task.go @@ -761,9 +761,9 @@ func modelRuntimeDefaults(m *db.Model) (thinking bool, contextLimit int, outputL // 后按目录结构展开;plugin 的 entry 字段再以 file:// 注入到 opencode.json 的 // `plugin` 数组里。Claude / Codex 不消费 plugin(spec §6.3)。 const ( - agentRuleBaseDir = "/tmp/codingmatrix-project-tpl/.ai-ready/rules/" - agentSkillBaseDir = "/tmp/codingmatrix-project-tpl/.ai-ready/skills/" - agentPluginBaseDir = "/tmp/codingmatrix-project-tpl/.ai-ready/plugins/" + agentRuleBaseDir = "${HOME}/.codingmatrix/project-tpl/.ai-ready/rules/" + agentSkillBaseDir = "${HOME}/.codingmatrix/project-tpl/.ai-ready/skills/" + agentPluginBaseDir = "${HOME}/.codingmatrix/project-tpl/.ai-ready/plugins/" ) // parseStringUUIDs 把字符串切片解析成 uuid.UUID 切片。单条解析失败时打一条 diff --git a/backend/templates/opencode.tmpl b/backend/templates/opencode.tmpl index c9b0c562..2ae5967b 100644 --- a/backend/templates/opencode.tmpl +++ b/backend/templates/opencode.tmpl @@ -39,5 +39,5 @@ }, "model": "monkeycode-ai/{{.model}}", "disabled_providers": ["openai", "opencode"], - "instructions": ["/tmp/codingmatrix-project-tpl/.ai-ready/rules/*.md"] + "instructions": ["${HOME}/.codingmatrix/project-tpl/.ai-ready/rules/*.md"] } From 8c7f95a797b5b094f65f71d27771e45a1ac47449 Mon Sep 17 00:00:00 2001 From: xmv97 Date: Wed, 17 Jun 2026 12:30:17 +0000 Subject: [PATCH 2/2] feat(task): declare skills.paths in opencode config OpenCode discovers skills from cfg.skills.paths (skill/index.ts), but the template only shipped instructions + plugin paths. Point skills.paths at the on-VM .ai-ready/skills dir so unpacked skills are auto-discovered. ${HOME} is expanded by the agent (os.ExpandEnv over the whole config body). Co-Authored-By: Claude Opus 4.6 (1M context) --- backend/templates/opencode.tmpl | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/backend/templates/opencode.tmpl b/backend/templates/opencode.tmpl index 2ae5967b..4333cc76 100644 --- a/backend/templates/opencode.tmpl +++ b/backend/templates/opencode.tmpl @@ -39,5 +39,8 @@ }, "model": "monkeycode-ai/{{.model}}", "disabled_providers": ["openai", "opencode"], - "instructions": ["${HOME}/.codingmatrix/project-tpl/.ai-ready/rules/*.md"] + "instructions": ["${HOME}/.codingmatrix/project-tpl/.ai-ready/rules/*.md"], + "skills": { + "paths": ["${HOME}/.codingmatrix/project-tpl/.ai-ready/skills/"] + } }