Revert "feat: seed Assistant workspace with update-configuration skill and improved docs"

This reverts commit 6a14bc6b69.
This commit is contained in:
Chris Scott committed 2026-04-27 18:07:41 +00:00
1 parent 6a14bc6b69
commit d0ddda01de
10 files changed
+19 -189

No files matched your search

+1 -1
View File
@@ -423,7 +423,7 @@ app.get('/', async (c) => {
const options = AssistantModeInitRequestSchema.parse(body)
const status = await ensureAssistantMode(repo, options)
if (status.files.opencodeJson.created || status.files.updateConfigurationSkill.created) {
if (status.files.opencodeJson.created) {
opencodeServerManager.clearStartupError()
await restartOpenCode(openCodeSupervisor)
}
+8 -81
View File
@@ -18,7 +18,6 @@ const ASSISTANT_MODE_DIR = 'assistant'
const ASSISTANT_MODE_RELATIVE_PATH = 'repos/assistant'
const ASSISTANT_AGENTS_MD_FILENAME = 'AGENTS.md'
const ASSISTANT_OPENCODE_CONFIG_FILENAME = 'opencode.json'
const ASSISTANT_UPDATE_CONFIGURATION_SKILL_PATH = path.join('.opencode', 'skills', 'update-configuration', 'SKILL.md')
export function getAssistantModeDirectory(): string {
const reposPath = getReposPath()
@@ -34,40 +33,22 @@ export function getAssistantModeDirectory(): string {
}
export function buildAssistantAgentsMd(): string {
return `# Assistant Directory
return `# Assistant Mode Instructions
This directory is the shared Assistant workspace for OpenCode Manager.
This folder is the shared Assistant mode workspace for OpenCode Manager.
## Purpose
Use this workspace to customize how the Assistant behaves across OpenCode Manager sessions. It is separate from your project repositories, so changes here are for the Assistant itself rather than application code.
This workspace is useful for:
- Durable Assistant instructions, preferences, and working agreements
- Assistant-specific OpenCode configuration
- Reusable skills and workflows for managing this environment
- Iterative improvements to how the Assistant helps you
## Files
- \`AGENTS.md\` defines Assistant instructions loaded for this workspace
- \`opencode.json\` defines OpenCode configuration for this workspace
- \`.opencode/skills/\` contains Assistant-scoped skills
## Customization
Edit \`AGENTS.md\` when you want to change the Assistant's default behavior, communication style, or durable preferences.
Edit \`opencode.json\` when you want to change OpenCode settings such as models, agents, providers, permissions, or plugins for this workspace.
Add skills under \`.opencode/skills/<skill-name>/SKILL.md\` when you want reusable workflows. The seeded \`update-configuration\` skill is for safely updating this workspace configuration and reloading OpenCode afterward.
Assistant mode provides an isolated space for:
- Self-editing agent instructions and preferences
- Customized workflows specific to this assistant workspace
- Iterative improvement of assistant behavior
## Self-Editing Rules
The agent MAY self-edit the following files within this workspace:
- \`AGENTS.md\` - Assistant instructions, persona, and durable preferences
- \`opencode.json\` - OpenCode configuration for this workspace
- \`.opencode/skills/\` - Assistant-scoped reusable workflows
## Constraints
@@ -75,49 +56,13 @@ The agent MAY self-edit the following files within this workspace:
- Self-edits should be concise and auditable
- Preserve user-customized content when modifying files
- Always ask for confirmation before making significant changes
- Validate JSON before saving \`opencode.json\`
- Reload or restart OpenCode after configuration or skill changes when needed
## Guidelines
1. Keep instructions clear and actionable
2. Update AGENTS.md when learning durable preferences
3. Prefer small configuration changes over broad rewrites
4. Maintain version control awareness
5. Document significant changes in commit messages
`
}
export function buildAssistantUpdateConfigurationSkill(): string {
return `---
name: update-configuration
description: Safely update Assistant workspace instructions, OpenCode config, and skills, then reload OpenCode configuration when needed.
---
# Update Configuration
Use this skill when the user wants to change how the Assistant workspace behaves, including edits to \`AGENTS.md\`, \`opencode.json\`, or Assistant-scoped skills.
## Workflow
1. Inspect the current Assistant workspace files before editing.
2. Identify the smallest configuration change that satisfies the request.
3. Preserve user-written instructions and existing settings unless the user asks to replace them.
4. Validate \`opencode.json\` as JSON after changes.
5. Reload or restart OpenCode configuration after changing \`opencode.json\` or skills.
6. Tell the user what changed and whether reload succeeded.
## Files
- \`AGENTS.md\` stores durable Assistant instructions and preferences.
- \`opencode.json\` stores Assistant workspace OpenCode settings.
- \`.opencode/skills/<name>/SKILL.md\` stores Assistant-scoped reusable workflows.
## Rules
- Do not rewrite the whole configuration when a targeted edit is enough.
- Do not remove user customizations unless explicitly requested.
- Do not edit project repositories unless the user explicitly asks.
- If reload fails, report the error and leave the files in a valid state.
3. Maintain version control awareness
4. Document significant changes in commit messages
`
}
@@ -155,11 +100,9 @@ export async function ensureAssistantMode(
const agentsMdPath = path.join(assistantDir, ASSISTANT_AGENTS_MD_FILENAME)
const opencodeJsonPath = path.join(assistantDir, ASSISTANT_OPENCODE_CONFIG_FILENAME)
const updateConfigurationSkillPath = path.join(assistantDir, ASSISTANT_UPDATE_CONFIGURATION_SKILL_PATH)
const agentsMdExists = await fileExists(agentsMdPath)
const opencodeJsonExists = await fileExists(opencodeJsonPath)
const updateConfigurationSkillExists = await fileExists(updateConfigurationSkillPath)
const overwriteAgentsMd = options?.overwriteAgentsMd ?? false
const overwriteOpenCodeConfig = options?.overwriteOpenCodeConfig ?? false
@@ -176,10 +119,6 @@ export async function ensureAssistantMode(
await writeFileContent(opencodeJsonPath, JSON.stringify(config, null, 2))
}
if (!updateConfigurationSkillExists) {
await writeFileContent(updateConfigurationSkillPath, buildAssistantUpdateConfigurationSkill())
}
return {
repoId: repo.id,
directory: assistantDir,
@@ -195,11 +134,6 @@ export async function ensureAssistantMode(
exists: true,
created: !opencodeJsonExists || overwriteOpenCodeConfig || hasLegacyOpenCodeConfig,
},
updateConfigurationSkill: {
path: updateConfigurationSkillPath,
exists: true,
created: !updateConfigurationSkillExists,
},
},
}
}
@@ -219,11 +153,9 @@ export async function getAssistantModeStatus(repo: Repo): Promise<AssistantModeS
const agentsMdPath = path.join(assistantDir, ASSISTANT_AGENTS_MD_FILENAME)
const opencodeJsonPath = path.join(assistantDir, ASSISTANT_OPENCODE_CONFIG_FILENAME)
const updateConfigurationSkillPath = path.join(assistantDir, ASSISTANT_UPDATE_CONFIGURATION_SKILL_PATH)
const agentsMdExists = await fileExists(agentsMdPath)
const opencodeJsonExists = await fileExists(opencodeJsonPath)
const updateConfigurationSkillExists = await fileExists(updateConfigurationSkillPath)
return {
repoId: repo.id,
@@ -240,11 +172,6 @@ export async function getAssistantModeStatus(repo: Repo): Promise<AssistantModeS
exists: opencodeJsonExists,
created: false,
},
updateConfigurationSkill: {
path: updateConfigurationSkillPath,
exists: updateConfigurationSkillExists,
created: false,
},
},
}
}
-2
View File
@@ -149,7 +149,6 @@ describe('Repo Routes', () => {
files: {
agentsMd: { path: '/tmp/workspace/repos/assistant/AGENTS.md', exists: false, created: false },
opencodeJson: { path: '/tmp/workspace/repos/assistant/opencode.json', exists: false, created: false },
updateConfigurationSkill: { path: '/tmp/workspace/repos/assistant/.opencode/skills/update-configuration/SKILL.md', exists: false, created: false },
},
}
@@ -203,7 +202,6 @@ describe('Repo Routes', () => {
files: {
agentsMd: { path: '/tmp/workspace/repos/assistant/AGENTS.md', exists: true, created: true },
opencodeJson: { path: '/tmp/workspace/repos/assistant/opencode.json', exists: true, created: true },
updateConfigurationSkill: { path: '/tmp/workspace/repos/assistant/.opencode/skills/update-configuration/SKILL.md', exists: true, created: true },
},
}
@@ -6,7 +6,6 @@ import {
getAssistantModeStatus,
getAssistantModeDirectory,
buildAssistantOpenCodeConfig,
buildAssistantUpdateConfigurationSkill,
} from '../../src/services/assistant-mode'
import { OpenCodeConfigSchema } from '@opencode-manager/shared/schemas'
import { getReposPath } from '@opencode-manager/shared/config/env'
@@ -96,16 +95,6 @@ describe('buildAssistantOpenCodeConfig', () => {
})
})
describe('buildAssistantUpdateConfigurationSkill', () => {
it('returns a valid update-configuration skill', () => {
const skill = buildAssistantUpdateConfigurationSkill()
expect(skill).toContain('name: update-configuration')
expect(skill).toContain('Validate `opencode.json` as JSON')
expect(skill).toContain('Reload or restart OpenCode configuration')
})
})
describe('ensureAssistantMode', () => {
beforeEach(() => {
vi.clearAllMocks()
@@ -121,7 +110,6 @@ describe('ensureAssistantMode', () => {
expect(result.relativePath).toBe('repos/assistant')
expect(result.files.agentsMd.exists).toBe(true)
expect(result.files.opencodeJson.exists).toBe(true)
expect(result.files.updateConfigurationSkill.exists).toBe(true)
})
it('does not overwrite existing customized files by default', async () => {
@@ -135,26 +123,10 @@ describe('ensureAssistantMode', () => {
expect(result.files.agentsMd.created).toBe(false)
expect(result.files.opencodeJson.exists).toBe(true)
expect(result.files.opencodeJson.created).toBe(false)
expect(result.files.updateConfigurationSkill.exists).toBe(true)
expect(result.files.updateConfigurationSkill.created).toBe(false)
expect(writeFile).not.toHaveBeenCalled()
})
it('creates the update-configuration skill when missing', async () => {
access
.mockResolvedValueOnce(undefined)
.mockResolvedValueOnce(undefined)
.mockRejectedValueOnce(new Error('File not found'))
const result = await ensureAssistantMode(mockRepo)
expect(result.files.updateConfigurationSkill.created).toBe(true)
const content = writeFile.mock.calls[0]?.[1]
expect(Buffer.isBuffer(content)).toBe(true)
expect((content as Buffer).toString('utf8')).toContain('name: update-configuration')
})
it('overwrites only files whose overwrite option is true', async () => {
access.mockResolvedValue(undefined)
@@ -206,7 +178,6 @@ describe('getAssistantModeStatus', () => {
access
.mockResolvedValueOnce(undefined)
.mockResolvedValueOnce(undefined)
.mockResolvedValueOnce(undefined)
const result = await getAssistantModeStatus(mockRepo)
@@ -214,6 +185,5 @@ describe('getAssistantModeStatus', () => {
expect(result.relativePath).toBe('repos/assistant')
expect(result.files.agentsMd.exists).toBe(true)
expect(result.files.opencodeJson.exists).toBe(true)
expect(result.files.updateConfigurationSkill.exists).toBe(true)
})
})
-52
View File
@@ -1,52 +0,0 @@
# Assistant Workspace
Assistant mode creates a shared workspace at `repos/assistant` for customizing how the OpenCode Manager Assistant behaves.
This workspace is separate from your project repositories. Use it for Assistant instructions, Assistant-specific OpenCode settings, and reusable workflows.
## First Run
The first time you open Assistant mode, OpenCode Manager creates:
- `AGENTS.md` - durable Assistant instructions and preferences
- `opencode.json` - OpenCode configuration for the Assistant workspace
- `.opencode/skills/update-configuration/SKILL.md` - a skill for safe config updates and reloads
Existing files are preserved. OpenCode Manager only seeds missing files or replaces legacy generated config that is no longer valid.
## Directory Layout
```text
repos/assistant/
├── AGENTS.md
├── opencode.json
└── .opencode/
└── skills/
└── update-configuration/
└── SKILL.md
```
## Customizing Assistant Behavior
Edit `AGENTS.md` when you want to change durable behavior, communication style, working agreements, or preferences.
Edit `opencode.json` when you want to change workspace-level OpenCode configuration such as permissions, agents, providers, plugins, or models.
Add skills under `.opencode/skills/<skill-name>/SKILL.md` when you want reusable Assistant workflows.
## Update Configuration Skill
The seeded `update-configuration` skill gives the Assistant a safe workflow for changing its own workspace configuration.
Use it when you want to:
- Update Assistant instructions in `AGENTS.md`
- Change Assistant workspace settings in `opencode.json`
- Add or modify Assistant-scoped skills
- Reload or restart OpenCode after configuration changes
The skill instructs the Assistant to inspect current files first, make the smallest safe edit, preserve user customizations, validate JSON, and report reload results.
## Sessions
Assistant sessions are scoped to the Assistant workspace directory. When you open Assistant mode, OpenCode Manager reopens the most recent Assistant session or creates a new one with onboarding guidance.
-8
View File
@@ -33,14 +33,6 @@ OpenCode Manager provides a comprehensive web interface for managing OpenCode AI
[Learn more →](chat.md)
### Assistant Workspace
- **Shared Assistant Directory** - Customize Assistant behavior outside project repositories
- **Seeded Instructions** - Start with editable `AGENTS.md` and `opencode.json` files
- **Configuration Skill** - Use the `update-configuration` skill to safely change and reload Assistant settings
[Learn more →](assistant.md)
### Schedules & Recurring Jobs
- **Recurring Repo Jobs** - Run reusable prompts against a repository on an interval or cron schedule
-2
View File
@@ -27,7 +27,6 @@ OpenCode Manager provides a web-based interface for OpenCode AI agents, allowing
- **View diffs** - See code changes with syntax highlighting
- **Control from anywhere** - Mobile-first PWA with push notifications
- **Configure AI** - Manage models, providers, and MCP servers
- **Customize Assistant** - Use the shared Assistant workspace for durable instructions and configuration workflows
## Key Features
@@ -51,7 +50,6 @@ OpenCode Manager provides a web-based interface for OpenCode AI agents, allowing
- [Installation Guide](getting-started/installation.md) - Detailed setup instructions
- [Quick Start](getting-started/quickstart.md) - Get up and running fast
- [Features Overview](features/overview.md) - Explore all features
- [Assistant Workspace](features/assistant.md) - Customize Assistant behavior and configuration
- [Schedules & Recurring Jobs](features/schedules.md) - Automate recurring repo reviews and follow-ups
- [Memory Plugin](features/memory.md) - Persistent project knowledge with semantic search ([GitHub](https://github.com/chriswritescode-dev/opencode-memory))
- [Configuration](configuration/environment.md) - Environment variables and setup
@@ -74,7 +74,7 @@ describe('useAssistantSessionLauncher', () => {
parts: [
expect.objectContaining({
type: 'text',
text: expect.stringContaining('Welcome to the OpenCode Manager Assistant workspace.'),
text: expect.stringContaining('Welcome to OpenCode Manager!'),
}),
],
})
@@ -40,22 +40,20 @@ export function useAssistantSessionLauncher({
parts: [
{
type: 'text',
text: `Welcome to the OpenCode Manager Assistant workspace.
text: `Welcome to OpenCode Manager! I'm your assistant and I'm here to help you work with your code.
This chat is running from the shared Assistant directory. Use it to customize how I behave across OpenCode Manager sessions without changing any project repository.
To get started, let's set up your assistant:
Start here:
**1. Name your assistant**
What would you like to call me? This name will help personalize our interactions.
**1. Review AGENTS.md**
This file contains durable instructions, preferences, and working agreements for this Assistant workspace.
**2. Configure AGENTS.md**
This file contains instructions that define my behavior, persona, and preferences. You can customize it to match your workflow. Take a moment to review and edit it - you can always adjust it later.
**2. Review opencode.json**
This file controls the OpenCode configuration for this workspace, including permissions and Assistant-specific settings.
**3. Set up your v file (optional)**
The v file stores conversation state and context between sessions. This helps me maintain memory of our work together.
**3. Use the update-configuration skill**
When you want me to change Assistant instructions, workspace config, or Assistant-scoped skills, ask me to use the update-configuration skill. I will make the smallest safe edit, preserve your customizations, validate config, and reload OpenCode when needed.
Tell me what you want this Assistant workspace to remember or how you want it customized.`,
Take your time exploring and customizing these settings. Let me know when you're ready to start coding, or if you have any questions about getting set up!`,
},
],
})
-1
View File
@@ -64,7 +64,6 @@ export const AssistantModeStatusSchema = z.object({
files: z.object({
agentsMd: AssistantModeFileSchema,
opencodeJson: AssistantModeFileSchema,
updateConfigurationSkill: AssistantModeFileSchema,
}),
})