进阶 zcode.z.ai 2026-11-25 14:51:22 · 6 阅读

第14章 ZCode Agent

Core FeaturesZCode Agent ZCode Agent is ZCode's first-party default agent and the primary entry point when you create a task. In one workspace you can describe the goal, add context, reference files, run commands, and pick the model and execution mode that fit the job. ZCode Agent is deeply co-tuned with the GLM-5.4 model family and carries a number of optimizations for long-horizon tasks, improving long-context retention and multi-turn tool-call stability so it can complete complex tasks end to end. Deep Integration with GLM-5.4 GLM-5.4 is built for long-horizon tasks, and ZCode Agent turns those model capabilities into a working coding experience: Stable 1M context: files, terminal output, browser state, and Git state stay in the same task for the whole run. Flexible effort: trade speed for depth per task through the reasoning effort control in the composer. Trained for agentic coding: multi-turn tool calls, subtask decomposition, and environment feedback are reinforced specifically, and combine with execution modes and Goal mode to finish long tasks. Officially recommended modelGLM-5.4Z.ai's latest flagship model for complex software engineering and agentic tasks: a stable 1M context, flexible reasoning effort, and strong long-horizon coding performance.1MContext window3Reasoning levels Workspace Entry The sidebar holds New task, Search, Automations, Plugin Marketplace, and the project / task list; the composer at the bottom offers project selection, + to add context, execution mode, model, and reasoning effort. Inside the composer, @ references files, plugins, and conversations, / runs commands, skills, and subagents, and $ calls a skill directly. Working Without a Project To ask a question or draft some text without a code repository, choose Work outside a project in the project menu above the composer, or click the new-task button beside the Tasks section in the sidebar. This is also the default state on first launch. These conversations live in the Tasks section and can be pinned, grouped, and archived. Files the Agent creates there stay on disk until you remove them; once sent, a conversation cannot be switched to a project conversation, and no Git branch selector is shown. Adding Context Describe the goal first, then add context precisely with these shortcuts so the Agent understands faster: ShortcutWhat it does+ Add contextAttach screenshots, documents, and other files, or pick plugins, files, and conversations from the menu@ MentionReference a file or folder in the workspace, an installed plugin (bringing its skills and MCP servers), or a past conversation/ InvokeRun saved commands, enabled skills, and subagents$ SkillCall a skill directly by name, for example $skill-name Long pasted text becomes an attachment automatically: the composer shows a single attachment entry while the full content still reaches the Agent. When you are signed in, the desktop composer shows a Voice input button to the left of the send button: click it and speak, and the recognized text is written into the composer; click again to stop recording. Voice input never sends on its own — review the text, then send. Asking About Selected Text Select any passage in the conversation (replies, reasoning, code, or tool results) and click Annotate in the floating toolbar. You can write a comment about the passage (or leave it empty to quote the text only); after you click Add annotation, it is sent to the Agent with your next message, and a numbered marker appears at that spot in the conversation. Streaming replies can be selected too. Debounce suits result-only events:AnnotateAdd in side chatSearch autocompleteForm validation01Select text, click AnnotateReplies, reasoning, or code1Add annotation · optionalWhat delay works for search?CancelAdd annotation02Add a commentOptional; leave it empty to quote onlySearch autocomplete11 annotationAsk for follow-up changes03Sent with your next messageA numbered marker shows the spot A message can carry at most 8 annotations; one annotation can quote at most 8,000 characters, and all annotations together at most 16,000 characters, with an explicit notice when a limit is hit. Only single-line selections are supported for now. When the current connection does not support annotations, the button is Add to chat instead, which quotes the text only. Project Instructions File Use AGENTS.md to shape the Agent's behavior over time. ZCode reads two locations when a task starts: SourcePathWhat to put thereGlobal user instructions~/.zcode/AGENTS.mdPersonal preferences and collaboration habits shared across projectsWorkspace instructionsAGENTS.md in the workspace rootProject-specific stack, layout, coding conventions, verification commands to run before committing, and caveats for high-risk files 1Global user instructions~/.zcode/AGENTS.md2Workspace instructions/AGENTS.mdInstructions the task starts with1Global2WorkspaceGlobal first, then workspaceNot readAGENTS.md in subdirectories@importCLAUDE.md (copied once on migration) When both exist, global instructions are concatenated first, then workspace instructions. ZCode does not scan subdirectories, expand @import, or merge multiple levels of AGENTS.md, so keep the important rules in the workspace root. CLAUDE.md is copied into AGENTS.md once when migrating a Claude Code project and is not read afterwards. Project Memory AGENTS.md is written by you; project memory lets the Agent accumulate knowledge itself. After each task finishes cleanly, ZCode records reusable facts and brings them into new sessions in the same project. Turn on Workspace Memory under Settings → Memory; it is off by default, applies to new sessions only, and adds some token usage. Memory stays on your machine, never enters Git, and subagents neither read nor write it. See Project Memory. Driving the Browser and Desktop ZCode Agent can drive the built-in browser directly: open URLs, click, fill forms, take screenshots, and decide the next step from the page state, so it can verify front-end changes by itself. It is on by default and managed under Settings → Browser Use; you watch it work in the browser panel on the right. See Browser Automation. Desktop apps outside the browser can be handed to the Agent too: after granting access under Settings → Computer Use, it can observe and operate visible application windows on your machine. See Computer Use for permissions and boundaries. Execution Modes The execution mode decides whether the Agent asks before editing files or running commands. From left to right, the Agent makes more decisions on its own: More carefulMore hands-offAsk before changesDefaultConfirms before every file edit or command.Best for: critical code and production configAutonomous modeAsks only when an action is risky.Best for: everyday iterationFull accessEdits and runs commands with as few interruptions as possible.Best for: clear, low-risk tasks There is also Plan mode: the Agent first only inspects the code and proposes a plan, and starts editing after you confirm — useful for complex work where the approach should be agreed first. It is a separate checkbox at the top of the execution mode menu, and you can also turn it on with /plan. Plan modePlans first, edits after you confirm; or type /planAsk before changesDefault: confirms before file edits and commandsAutonomous modeAsks only when an action is riskyFull accessFewest interruptions; confirm the risk when switching Switching to Full access asks you to confirm the risks in a dialog first. Press Ctrl + Shift + M to cycle through Ask before changes → Autonomous mode → Full access; the shortcut can be changed in Settings → Keyboard Shortcuts. Reasoning Effort Reasoning effort sets how much reasoning the model spends before answering: higher is steadier but slower. Click the model name at the bottom right of the composer and adjust the Effort slider at the bottom of the model menu, or press Ctrl + T to cycle. GLM-5.4 offers three levels: FasterDeeperLowFastest responses.Best for: simple questions and small, clear editsHighBalances speed and quality.Best for: everyday developmentMaxDefaultThinks most thoroughly.Best for: architecture, hard bugs, and long-running tasks Other models expose their own levels in the same control, and default to the highest one. Side Conversation When a main task is running and you want to ask something without interrupting it, open a side conversation: a separate tab in the right sidebar that inherits the main session's history as context but starts with a blank view, and can still use tools and edit files. Main taskRunningSide conversationThe quoted selectionWhy cache this first?Inherits the main history; the main task keeps goingOpen it fromSelect text→Add in side chatType /side or /btwRight sidebar→+→Side conversation Ways to open one (any of these): Select text in the main conversation and click Add in side chat; the selection comes along as a quote. Type /side or /btw in the composer; text after the command is sent as the side conversation's first message. Choose Side conversation from the + menu in the right sidebar. The last two still work while the main task is waiting on a permission prompt. Limits to know: No Goal mode, edit-and-resend, or forking; one main task can have several side conversations open at once; desktop only. It is temporary: closing the tab, deleting or archiving the main task, or quitting the app discards it, and it never appears in the task list or recently closed. For a discussion worth keeping, start a proper task. Forking a Conversation To try a different direction from some point without losing progress, hover over a completed assistant message and click Fork. ZCode creates a new task from that message, marked "Forked from conversation"; the original session is kept intact. Original sessionKept intactForkNew taskForked from conversationCarries history up to the fork, model and reasoning settings, and goal progressIn a local Git project, Fork asks first:Fork in the current folderShares the same filesFork into a new worktreeIncludes uncommitted changes In a local Git project, clicking Fork opens a menu first: Fork in the current folder lets the new task share the same files as the original session; Fork into a new worktree creates a separate worktree for the new task and includes uncommitted changes. Carried into the new taskNot carried overConversation history up to the fork pointFile changes on disk (when forking in the current folder, both sessions work on the same files; nothing is rolled back)Model and reasoning-effort settingsThe send queueGoal progressBackground work Interrupted or failed replies, user messages, and tool results have no fork entry, and forking is unavailable while context compaction is in progress. Sharing a Conversation Click Share at the right of the conversation title bar to turn the conversation into a link: Choose the content: all completed content is shared by default. Click Adjust to pick only some turns. A turn that is still running can be shared once it finishes. Access: Only me, Anyone with the link can view, or Anyone with the link can import and continue. Expiration: pick one from the list. The link stops working when it expires. Confirm there's nothing sensitive: nothing is scanned or redacted automatically. Review the messages, tool inputs and outputs, and generated code and files, looking especially for credentials, tokens, passwords, private keys, internal addresses, and personal information. Then check the confirmation box and click Create share link. Share conversationContentAll completed content · 6 turnsAdjustAccessAnyone with the link can viewExpires in1 dayReviewed; no sensitive informationNot checked automaticallyCreate share linkShare createdCopy linkOpen in browserSnapshot at share timeAccess optionsOnly meAnyone with the link can viewAnyone with the link can import and continue The share page is a snapshot taken when you share; it does not follow later changes to the conversation. Artifacts in the conversation, such as HTML reports and images, are uploaded with it and can be opened or downloaded from the share page. Types that aren't supported yet, or files that can't be read, are skipped, and you're told which ones after the link is created. When access is Anyone with the link can import and continue, the recipient can sign in to ZCode, import the conversation into their own workspace, and continue on the copy. The imported session is marked Imported from share; the original conversation is not affected. Settings → Shares lists active shares with the time remaining. From there you can copy a link, go to the conversation, or: Stop sharing: the link stops working at once and can be restored later. Copies that were already imported are not affected. Delete: the link stops working for good and the shared content is removed. This can't be undone. Sharing requires signing in to ZCode. Deploying a Website ZCode Agent can deploy a page or small app it built to ZCode Sites and give you a public link, which suits previewing and sharing demos, prototypes, and small tools. Deploying requires signing in to ZCode. Ask in the conversation, for example "deploy this page so I can share it", or type /site-deploy. ZCode Agent then: Checks that Sites is the right target: new or throwaway projects go to ZCode Sites. A real project with its own deployment process is shipped the project's own way unless you explicitly ask for ZCode Sites. Asks for your confirmation first: it tells you what will be uploaded and that anyone with the link can open the site. Secrets such as .env files are never uploaded. Builds and checks the project: it confirms the app starts locally, uploads and deploys it, and finishes with the site address. The address is a prefix based on the project plus 4 random characters, and it stays the same when you redeploy. Deploy this page so I can share itConfirm upload: the site is public; secrets like .env are never uploadedBuild and check locallyPreparingUploadingPublishingVerifyingDeployedtokyo-trip-2026-x7k2SitesTokyo 3-day trip● Onlinetokyo-trip-2026-x7k2 · 128 PV in 24hDeploymentsCurrent productionShow ZCode badge After deploying, open Add tab (+) → Sites in the right-side panel to see every site, its status, page views in the last 24 hours, and its deployments. You can also turn Show ZCode badge (the Made with ZCode mark at the bottom right of the site) on or off; free plans always show it. Common actions also have commands: CommandWhat it does/site-deployDeploy or redeploy/site-statusShow the site address, its status, and the latest deployment/site-logsShow deployment logs and explain a failure/site-analyticsVisit analytics: page views, visitors, top pages, referrers, and devices/site-usageThis month's transfer, requests, and storage against your plan limits/site-offline / /site-onlineTake the site offline or bring it back; the address and deployments are kept/site-badgeHide or show the ZCode badge (paid plans) Sites run Node.js 24 and Python 3.12, one HTTP service per site, with 1 vCPU and 1 GB of memory. The writable /data directory is temporary and is cleared on restart, and there is no database or secret injection. For a project that needs a database, persistent storage, or background jobs, ZCode Agent checks an alternative with you first. Deployed content goes through content review; a version that fails review is taken offline, and you can change the content and deploy again. Workflow Suggestions State the goal, then add context: reference key files with @ and attach screenshots or requirement docs; use Goal mode for long, multi-round tasks. Pick the execution mode by risk: Autonomous mode or Full access for routine edits; Plan mode or Ask before changes for critical files and pre-commit checks. Save effort with commands and skills: turn fixed procedures into / commands and reusable capabilities into $ skills. Keep one task moving: follow-ups, extra constraints, reviewing changes, and pre-commit checks all belong in the same session so the context stays together. Next Steps Edit HistoryModify previously sent messages and adjust instructions dynamically.CommandSave common prompts as reusable commands.Goal modeSet a goal with /goal and let the Agent drive it to confirmed completion.

评论 (0)