OpenCode Agent Introduction ​

This section introduces the OpenCode Agent / Skill / MCP system. These capabilities are provided by OpenCode, and Witty CLI registers and reuses them through its managed configuration.

Agent System ​

Witty Built-in Agent: witty-builtin-agent ​

witty-builtin-agent is the default primary agent provided by the witty-builtin-agent subpackage. It is defined in /usr/share/witty/opencode/config.d/witty-builtin-agent.json and merged into /etc/opencode/opencode.json by the loader.

FieldValue
modeprimary
DescriptionKnowledge Q&A, command lookup, fault diagnosis, solution planning, and visual reports
Color#5F87FF
Prompt\{file:/usr/share/witty/opencode/agents/witty-builtin-agent/witty-builtin-agent.md}

OpenCode Built-in Agents ​

Besides witty-builtin-agent, OpenCode provides several built-in agents, as shown by opencode agent list:

AgentModeDescription
buildprimaryDefault main agent
planprimaryPlanning agent
summary / titleprimarySummary / title generation
explore / general / baize / dayu / kuafu / nuwasubagentSubagents for various purposes
fuxiallMain agent and subagent

Diagnostic Capability Package: witty-diagnosis-agent ​

witty-diagnosis-agent is an optional diagnostic capability package. It does not register as a standalone agent; it declares plugins in config.d/witty-diagnosis-agent.json and installs a large number of diagnostic Skills under /usr/share/witty/opencode/skills/witty-diagnosis-agent/. After installation, these Skills and plugin context are injected into the current agent.

Usage:

bash
sudo dnf install witty-diagnosis-agent

OpenCode / Witty loads the new Skills automatically after installation; run witty server restart to make them available to an already running server.

Skill System ​

Skills are OpenCode scenario capability packages loaded through skills.paths; Witty manages them as /usr/share/witty/opencode/skills.

Witty Built-in Skills (from the witty-builtin-agent subpackage) ​

SkillPurpose
manpage-skillLooks up usage, options, and examples of Linux / openEuler commands
log-anomaly-detectorAnalyzes system logs and performance metrics for preliminary fault localization
html-report-generatorRenders diagnostic reports and solutions as web pages
brainstorm-beagleProduces complete actionable solutions when goals are unclear
plantuml-skillDraws flowcharts, sequence diagrams, and architecture diagrams

Experience Skill Management: experience-skill ​

experience-skill is the core knowledge engine of Witty. It supports creating, evaluating, searching, merging, and optimizing two types of experience, Skill (workflow skills) and Wiki (distilled documents). Its CLI provides the subcommands sync, add-experiences, list-experiences, search-experiences, delete-*, and web, where web is the experience management interface.

Diagnostic Skills (from the witty-diagnosis-agent subpackage) ​

Installing witty-diagnosis-agent provides dozens of diagnostic Skills, for example:

  • linux-oom-analyzer, memory-leak-diagnosis, process-hang-diagnosis
  • network-diagnosis, dns-resolution-diagnosis, tls-certificate-diagnosis
  • disk-health-diagnosis, coredump_diagnose, kernel-io-uring-diagnosis
  • root-cause-analysis, root-cause-localization, fault-rca-report-generation and others

MCP System ​

openeuler_portal ​

openeuler_portal is the built-in local MCP of Witty. It uses npx -y openeuler-portal-mcp to query openEuler official site data, covering compatibility, CVE, packages, documents, SIGs, issues and pull requests. Its tokens (OPENEULER_TOKEN, GITCODE_TOKEN, FORUM_TOKEN) are injected through environment variables.

json
"mcp": {
  "openeuler_portal": {
    "type": "local",
    "command": ["npx", "-y", "openeuler-portal-mcp"],
    "environment": {
      "OPENEULER_TOKEN": "${OPENEULER_TOKEN}",
      "GITCODE_TOKEN": "${GITCODE_TOKEN}",
      "FORUM_TOKEN": "${FORUM_TOKEN}"
    },
    "enabled": true,
    "timeout": 30000
  }
}

Permission Policy ​

Default permission policy of witty-builtin-agent, excerpted:

json
"permission": {
  "*": "ask",
  "read": { "*": "allow", "*.env": "ask" },
  "edit": "allow",
  "glob": "allow",
  "grep": "allow",
  "webfetch": "allow",
  "websearch": "allow",
  "skill": "allow",
  "task": "allow",
  "openeuler_portal_*": "allow",
  "bash": "allow",
  "external_directory": { "*": "ask", "/tmp/**": "allow", "/usr/share/witty/**": "allow" }
}
  • Read-only operations such as querying system information, reading files, and checking status are allowed by default;
  • Dangerous operations such as changing configuration, installing software, restarting services, and deleting files default to ask and require user confirmation;
  • Sensitive data is processed locally and is not uploaded without authorization.

Field semantics of permission follow opencode.ai/docs.