Open-source Grok Bot alternative with a virtual machine that bots can use
TypeScript ai-agentsclaude-codecodexcomputer-usedockerelectrongrokgrok-botgrok-bot-alternativeself-hostedtypescript
Project skills: Codex's own folder, model-only skills, links into app data
Absterrg05fa3025cef72
diff --git a/docs/custom-mcp-servers.md b/docs/custom-mcp-servers.mdindex fe33755e98..2f074cb1a6 100644--- a/docs/custom-mcp-servers.md+++ b/docs/custom-mcp-servers.md@@ -420,14 +420,18 @@ the original.A project can ship skills for any AI agent in `agents/skills`, `.agents/skills`or `.claude/skills`. When a bot works in such a folder (or one below it, up tothe git root; outside a repository, only the working folder itself counts), its-**Skills** page lists them under **In this project**, with-the switch **Use the project's skills**. They stay out of every prompt until-that switch is on, since they are the checkout's own instructions; it applies-to every bot, and in `config.json` it is `"features": { "projectSkills": true }`.-Once on, a bot's prompt lists each one with its SKILL.md path and `/name` runs-it. The bot's own, library and brought-in skills keep their names, Claude Code-keeps loading `.claude/skills` by itself, an engine without file tools gets-none, and they never travel in a bot or team package.+**Skills** page lists them under **In this project**, with the switch **Use the+project's skills**. Off, OpenMausBot puts none of them in a prompt, since they+are the checkout's own instructions. On, it trusts every project folder every+bot works in, now and later; in `config.json` it is+`"features": { "projectSkills": true }`. The switch doesn't govern what an+engine loads by itself: Claude Code loads `.claude/skills` and Codex loads+`.agents/skills` either way, and those show as the engine's own skills, each+with the bot's own switch. Once on, a bot's prompt lists each project skill with+its SKILL.md path and `/name` runs it, except one marked `user-invocable: false`,+which only the model uses. The bot's own, library and brought-in skills keep+their names, an engine without file tools gets none, and they never travel in a+bot or team package.The switch drops the CLI flag `--strict-mcp-config` (Claude Code 1.0.60+)while keeping `--setting-sources project` (1.0.122+). The environment variablediff --git a/server/host/skills-library.ts b/server/host/skills-library.tsindex 816397061f..e1acbbdc2d 100644--- a/server/host/skills-library.ts+++ b/server/host/skills-library.ts@@ -324,7 +324,7 @@ export function createSkillsLibraryHost(deps: SkillsLibraryHostDeps) {]);add(nativesFor(bot, threadId, instance, cwd).filter((skill) => !switched.has(skill.name)));}- if (files.size < mentioned.length) add(projectInUse(bot, threadId, cwd, instance, assigned));+ if (files.size < mentioned.length) add(projectInUse(bot, threadId, cwd, instance, assigned).filter((skill) => !skill.modelOnly));return skillCommandTurnText(text, files, typed, ownStart);},diff --git a/server/native-skills.test.ts b/server/native-skills.test.tsindex b4191af9b2..ab7b86bf1e 100644--- a/server/native-skills.test.ts+++ b/server/native-skills.test.ts@@ -189,14 +189,14 @@ describe("skills a project ships for any agent", () => {it("show on the bot's Skills page, off until the owner trusts project skills, and never reach a turn until then", () => {const paths = plantRepo();- const off = hostFor("codex", { cwd: join(repo, "app") });+ const off = hostFor("geminiAgent", { cwd: join(repo, "app") });expect(listed(off.host.listBotSkills(off.bot))).toEqual(["agents-skill:project", "dot-agents-skill:project", "claude-skill:project"]);expect(off.host.listBotSkills(off.bot).every((skill) => !skill.enabled && !skill.editable)).toBe(true);expect(off.host.readBotSkillFile(off.bot, "claude-skill")).toBe(skillMd("claude-skill"));expect(off.host.skillsIndex(off.bot, "main")).toBe("");expect(off.host.expandSkillCommand(off.bot, "main", "/claude-skill go", undefined, [], true)).toBe("/claude-skill go");- const on = hostFor("codex", { cwd: join(repo, "app"), cfg: trusted });+ const on = hostFor("geminiAgent", { cwd: join(repo, "app"), cfg: trusted });const index = on.host.skillsIndex(on.bot, "main");expect(index).toContain("Skills in this project:");expect(index).toContain(`- agents-skill: Works with agents-skill. Read ${JSON.stringify(paths.nearer)}.`);@@ -212,14 +212,14 @@ describe("skills a project ships for any agent", () => {const loose = join(PROJECTS, "loose", "app");plant(join(PROJECTS, "loose", "agents", "skills"), "above");const here = plant(join(loose, ".agents", "skills"), "here");- const { host, bot } = hostFor("codex", { cwd: loose, cfg: trusted });+ const { host, bot } = hostFor("geminiAgent", { cwd: loose, cfg: trusted });expect(listed(host.listBotSkills(bot))).toEqual(["here:project"]);expect(host.skillsIndex(bot, "main")).toContain(JSON.stringify(here));});it("follow the folder a turn really works in", () => {const paths = plantRepo();- const { host, bot } = hostFor("codex", { cfg: trusted });+ const { host, bot } = hostFor("geminiAgent", { cfg: trusted });expect(host.skillsIndex(bot, "main")).toBe("");expect(host.skillsIndex(bot, "main", undefined, repo)).toContain(JSON.stringify(paths.agents));expect(host.skillsIndex(bot, "main", undefined, null)).toBe("");@@ -227,12 +227,47 @@ describe("skills a project ships for any agent", () => {it("never run from the bot's folder for a resumed thread that will stay where its session is", () => {plantRepo();- const { host, bot } = hostFor("codex", { cwd: repo, cfg: trusted, resumed: true });+ const { host, bot } = hostFor("geminiAgent", { cwd: repo, cfg: trusted, resumed: true });expect(listed(host.listBotSkills(bot, "pinned"))).toEqual([]);expect(host.expandSkillCommand(bot, "pinned", "/claude-skill go", undefined, [], true)).toBe("/claude-skill go");expect(host.expandSkillCommand(bot, "main", "/claude-skill go", undefined, [], true)).toContain("claude-skill");});+ it("leave .agents/skills to Codex, which loads it by itself", () => {+ const paths = plantRepo();+ const { host, bot } = hostFor("codex", { cwd: join(repo, "app"), cfg: trusted });+ expect(listed(host.listBotSkills(bot))).toEqual(["agents-skill:native", "dot-agents-skill:native", "claude-skill:project"]);+ const index = host.skillsIndex(bot, "main");+ expect(index).toContain(JSON.stringify(paths.claude));+ expect(index).not.toContain("dot-agents-skill");+ expect(index).not.toContain("- agents-skill:");+ });++ it("list a model-only skill for the model, but never run it with /name", () => {+ mkdirSync(join(repo, ".git"), { recursive: true });+ const folder = join(repo, "agents", "skills", "background");+ mkdirSync(folder, { recursive: true });+ writeFileSync(join(folder, "SKILL.md"), "---\ndescription: House style.\nuser-invocable: false\n---\n\nUse it.\n");+ const { host, bot } = hostFor("geminiAgent", { cwd: repo, cfg: trusted });+ expect(host.skillsIndex(bot, "main")).toContain("- background: House style.");+ expect(host.expandSkillCommand(bot, "main", "/background go", undefined, [], true)).toBe("/background go");+ });++ it.skipIf(process.platform === "win32")("never come from the app's own folders through a link", () => {+ mkdirSync(join(repo, ".git"), { recursive: true });+ plant(join(DATA_DIR, "app-skills"), "app-owned");+ mkdirSync(join(repo, "agents", "skills"), { recursive: true });+ symlinkSync(join(DATA_DIR, "app-skills", "app-owned"), join(repo, "agents", "skills", "app-owned"), "dir");+ const linkedRepo = join(PROJECTS, "linked");+ symlinkSync(join(DATA_DIR, "workspaces"), linkedRepo, "dir");+ plant(join(DATA_DIR, "workspaces", ".agents", "skills"), "inside");+ const { host, bot } = hostFor("geminiAgent", { cwd: repo, cfg: trusted });+ expect(listed(host.listBotSkills(bot))).toEqual([]);+ expect(host.skillsIndex(bot, "main", undefined, linkedRepo)).toBe("");+ rmSync(join(DATA_DIR, "app-skills"), { recursive: true, force: true });+ rmSync(join(DATA_DIR, "workspaces", ".agents"), { recursive: true, force: true });+ });+it("leave .claude/skills to Claude Code, which loads it by itself", () => {const paths = plantRepo();const { host, bot } = hostFor("claudeAgent", { cwd: repo, cfg: trusted });@@ -244,7 +279,7 @@ describe("skills a project ships for any agent", () => {it("never run in a conversation that keeps a private folder", () => {plantRepo();- const { host, bot } = hostFor("codex", { cwd: repo, cfg: trusted });+ const { host, bot } = hostFor("geminiAgent", { cwd: repo, cfg: trusted });expect(host.expandSkillCommand(bot, "guest", "/claude-skill go", undefined, [], true, true)).toBe("/claude-skill go");expect(host.expandSkillCommand(bot, "guest", "/claude-skill go", undefined, [], true)).toContain("claude-skill");});@@ -262,7 +297,7 @@ describe("skills a project ships for any agent", () => {it("yield a name to the bot's own skill, even one switched off", () => {plantRepo();- const { host, bot } = hostFor("codex", { cwd: repo, cfg: trusted });+ const { host, bot } = hostFor("geminiAgent", { cwd: repo, cfg: trusted });installSkill(bot.id, "local", [{ path: "SKILL.md", content: skillMd("agents-skill") }]);expect(listed(host.listBotSkills(bot))).toEqual(["agents-skill:own", "dot-agents-skill:project", "claude-skill:project"]);expect(host.skillsIndex(bot, "main")).not.toContain("- agents-skill:");@@ -271,7 +306,7 @@ describe("skills a project ships for any agent", () => {it("never come from the app's own folders, nor reach an engine that cannot read files, nor a package", () => {plant(join(TASK_WORKSPACES_DIR, ".agents", "skills"), "app-link");- const task = hostFor("codex", { cfg: trusted });+ const task = hostFor("geminiAgent", { cfg: trusted });expect(listed(task.host.listBotSkills(task.bot))).toEqual([]);expect(task.host.skillsIndex(task.bot, "main", undefined, join(DATA_DIR, "workspaces", task.bot.id))).toBe("");@@ -279,7 +314,7 @@ describe("skills a project ships for any agent", () => {const api = hostFor("openai-compat", { cwd: repo, cfg: trusted });expect(listed(api.host.listBotSkills(api.bot))).toEqual([]);- const exported = hostFor("codex", { cwd: repo, cfg: trusted });+ const exported = hostFor("geminiAgent", { cwd: repo, cfg: trusted });const team = skillExport(exported.host).collectTeamSkills([exported.bot], "all");expect(team.ok && [...team.skillsByBot.values()].flat()).toEqual([]);expect(skillExport(exported.host).checkedExportSkillNames(["agents-skill"], [exported.bot])).toMatchObject({ ok: false });diff --git a/server/native-skills.ts b/server/native-skills.tsindex 7b650c23a3..d34fc43bdc 100644--- a/server/native-skills.ts+++ b/server/native-skills.ts@@ -5,7 +5,7 @@ import { dirname, join, resolve } from "node:path";import { DESCRIPTION_MAX, isSkillName, readSkillFrontmatter, SKILL_FILE_MAX_BYTES } from "../shared/skill-md.ts";import { nativeSkillFolders, readFileNoFollow, skillIndexBlock, type ImportedSkillView, type SkillTurnEngine } from "./imported-skills.ts";-import { isInside } from "./sentinel/paths.ts";+import { isInside, resolveThroughLinks } from "./sentinel/paths.ts";import { entryExistsWithoutFollowing } from "./skill-storage.ts";import type { SkillListing } from "./skills.ts";@@ -13,6 +13,8 @@ export interface NativeSkill extends ImportedSkillView {/** The skills folder it was found in. */source: string;sha256: string;+ /** `user-invocable: false`: the model may use it, but `/` never runs it. */+ modelOnly?: true;}/** A turn's folder and each folder above it, up to the nearest git root, never the home folder, which holds the person's@@ -28,8 +30,8 @@ function projectLevels(cwd: string, home: string): string[] {/** A skill folder may be a link, as the engine follows it; SKILL.md itself must be a plain file of a skill's size. As in* Claude Code (2.1.304), the folder names the command, frontmatter is optional, and `user-invocable: false` keeps a- * skill out of `/`. */-function readNativeSkill(root: string, name: string): NativeSkill | null {+ * skill out of `/` (here, out of the list too unless `modelOnly` asks for it). */+function readNativeSkill(root: string, name: string, modelOnly = false): NativeSkill | null {const folder = join(root, name);const file = join(folder, "SKILL.md");try {@@ -41,14 +43,18 @@ function readNativeSkill(root: string, name: string): NativeSkill | null {const text = readFileNoFollow(file)?.toString("utf8");if (!text) return null;const frontmatter = readSkillFrontmatter(text);- if (/^(?:false|no|off|0)$/i.test(frontmatter?.fields["user-invocable"] ?? "")) return null;+ const notInvocable = /^(?:false|no|off|0)$/i.test(frontmatter?.fields["user-invocable"] ?? "");+ if (notInvocable && !modelOnly) return null;const firstParagraph = (frontmatter?.body ?? text).trim().split(/\r?\n\s*\r?\n/)[0]!.replace(/\s+/g, " ");const description = (frontmatter?.fields.description || firstParagraph).slice(0, DESCRIPTION_MAX);- return { name, description, folder, file, source: root, sha256: createHash("sha256").update(text).digest("hex") };+ return {+ name, description, folder, file, source: root, sha256: createHash("sha256").update(text).digest("hex"),+ ...(notInvocable ? { modelOnly: true as const } : {}),+ };}/** Each skill in `roots`, the first of a name winning. */-function skillsIn(roots: readonly string[], seen = new Set<string>()): NativeSkill[] {+function skillsIn(roots: readonly string[], options: { modelOnly?: boolean; outside?: string } = {}, seen = new Set<string>()): NativeSkill[] {return roots.flatMap((root) => {let names: string[];try {@@ -58,7 +64,8 @@ function skillsIn(roots: readonly string[], seen = new Set<string>()): NativeSki}return names.flatMap((name) => {if (seen.has(name)) return [];- const skill = readNativeSkill(root, name);+ if (options.outside && isInside(resolveThroughLinks(join(root, name)), options.outside)) return [];+ const skill = readNativeSkill(root, name, options.modelOnly);if (!skill) return [];seen.add(name);return [skill];@@ -66,15 +73,18 @@ function skillsIn(roots: readonly string[], seen = new Set<string>()): NativeSki});}+/** The project folder an engine loads skills from by itself, in a turn's folder and each one above it: Claude Code's+ * `.claude/skills` (2.1.304) and Codex's `.agents/skills` (0.167). */+const ENGINE_PROJECT_DIRS: Record<string, string> = { claudeAgent: ".claude/skills", codex: ".agents/skills" };+/** The skills an engine loads by itself for turns in `cwd` (null: no folder of its own), read only. The person's own* folder wins a name, as in Claude Code, then the nearer project folder. */export function nativeSkills(engine: SkillTurnEngine,options: { claudeUserSkills: boolean; cwd: string | null; home?: string },): NativeSkill[] {- const project = engine.driverKind === "claudeAgent" && options.cwd- ? projectLevels(options.cwd, options.home ?? homedir()).map((level) => join(level, ".claude", "skills"))- : [];+ const dir = ENGINE_PROJECT_DIRS[engine.driverKind];+ const project = dir && options.cwd ? projectLevels(options.cwd, options.home ?? homedir()).map((level) => join(level, dir)) : [];return skillsIn([...nativeSkillFolders(engine, options), ...project]);}@@ -82,14 +92,15 @@ const PROJECT_SKILL_DIRS = [".agents/skills", "agents/skills", ".claude/skills"]/** The skills a project ships for any agent, in the folders the engine does not load by itself, from `cwd` up to the* nearest git root, or in `cwd` alone outside a repository, so a folder above the project never counts as part of it;- * the nearer folder wins a name. None for a folder inside `dataDir`: those are the app's own, and hold links to the- * bot's own skills. */+ * the nearer folder wins a name. None from inside `dataDir`, links followed: those folders are the app's own, and hold+ * links to the bot's own skills. */export function projectSkills(engine: SkillTurnEngine, options: { cwd: string; dataDir: string; home?: string }): NativeSkill[] {- if (isInside(options.cwd, options.dataDir)) return [];- const dirs = engine.driverKind === "claudeAgent" ? PROJECT_SKILL_DIRS.filter((dir) => dir !== ".claude/skills") : PROJECT_SKILL_DIRS;+ const dataDir = resolveThroughLinks(options.dataDir);+ if (isInside(resolveThroughLinks(options.cwd), dataDir)) return [];+ const dirs = PROJECT_SKILL_DIRS.filter((dir) => dir !== ENGINE_PROJECT_DIRS[engine.driverKind]);const levels = projectLevels(options.cwd, options.home ?? homedir());const inRepo = levels.some((level) => entryExistsWithoutFollowing(join(level, ".git")));- return skillsIn((inRepo ? levels : levels.slice(0, 1)).flatMap((level) => dirs.map((dir) => join(level, dir))));+ return skillsIn((inRepo ? levels : levels.slice(0, 1)).flatMap((level) => dirs.map((dir) => join(level, dir))), { modelOnly: true, outside: dataDir });}/** After the skills from this computer, in a turn's skills index. */diff --git a/src/components/bot-panel/pages.tsx b/src/components/bot-panel/pages.tsxindex 069a055eb9..41a6182def 100644--- a/src/components/bot-panel/pages.tsx+++ b/src/components/bot-panel/pages.tsx@@ -449,7 +449,7 @@ export function SkillsPage({ bot }: PageContext) {))}{skills.error && !skills.reviewing && <NoteRow tone="warn">{skills.error}</NoteRow>}</Card>- {project.length > 0 && (+ {(project.length > 0 || projectOn) && (<Card label={t("botPanel.skills.project")} anchor="project-skills"><SwitchRowdata-panel-row="project-skills"diff --git a/src/components/bot-settings/SkillsSection.tsx b/src/components/bot-settings/SkillsSection.tsxindex bab64f1c8d..67df301eb5 100644--- a/src/components/bot-settings/SkillsSection.tsx+++ b/src/components/bot-settings/SkillsSection.tsx@@ -498,7 +498,7 @@ export function SkillsSection({ bot }: { bot: Bot }) {</span>)}<div className="mt-0.5 line-clamp-2 text-[12px] text-ink-secondary">{skill.description}</div>- <div className="mt-0.5 text-[11px] text-ink-secondary">{t(skill.enabled && !skillSwitchOn(skill) ? "skills.foundWhenNeeded" : "skills.usedWhenRelevant")}</div>+ <div className="mt-0.5 text-[11px] text-ink-secondary">{t(skill.origin === "project" && !skill.enabled ? "skills.projectOff" : skill.enabled && !skillSwitchOn(skill) ? "skills.foundWhenNeeded" : "skills.usedWhenRelevant")}</div></button>{skill.origin !== "project" && (<Switchdiff --git a/src/locales/en.json b/src/locales/en.jsonindex f8ad6445dd..f1cd6bad0f 100644--- a/src/locales/en.json+++ b/src/locales/en.json@@ -4528,7 +4528,7 @@"botPanel.skills.browse": "Browse skills","botPanel.skills.project": "In this project","botPanel.skills.projectUse": "Use the project's skills",- "botPanel.skills.projectHint": "Skills this project ships for AI agents. Off until you trust the project: they are its own instructions. Applies to every bot. Claude bots load the project's .claude/skills by themselves either way.",+ "botPanel.skills.projectHint": "Skills a project folder ships for AI agents: its own instructions. On, every bot uses the skills of every project folder it works in, now and later. Claude bots load .claude/skills and Codex bots load .agents/skills by themselves either way.","botPanel.skills.projectFailed": "Couldn't change project skills. Try again.","botPanel.folder.private": "Private","botPanel.folder.intro": "Where {name} keeps and edits files.",@@ -6196,6 +6196,7 @@"skills.origin.nativeHint": "The bot's AI loads this from the folder under Source. Turn it off here for this bot only; the files stay where they are. On Codex, while any is off here, this bot's replies skip the skills.config list in ~/.codex/config.toml.","skills.origin.project": "project","skills.origin.projectHint": "Shipped in the project folder under Source. The bot uses it while project skills are on. Edit or remove it there.",+ "skills.projectOff": "Off: project skills are off for every bot.","skills.write.title": "Write a command","skills.write.hint": "Give the bot a short command for something you ask often. Type /name in a chat to run it. Anything after the name fills in {input}.","skills.write.name": "Command name",