TL;DR: Here’s the layer I do
| Layer | Tool | Problem It Solves |
|---|---|---|
| 1 — RAG | Context7 + Tavily | Outdated docs → hallucinated code |
| 2 — Context Engineering | context-mode | Tool output bloat → burned context window |
| 3 — Code Intelligence | GitNexus | Blind edits → breaking unknown dependencies |
| 4 — Vision | agent-browser + zai-mcp-server | Terminal blindness → can’t see UI or errors |
| 5 — Model Provider | Z.ai Coding Plan | Models + MCP servers (vision, search, GitHub) |
| Core — Prompt Engineering | Superpowers | Inconsistent processes → babysitting sessions |
Start with whatever solves your biggest pain point:
- Outdated docs → Context7
- Context bloat → context-mode
- Blind edits → GitNexus
- Inconsistent workflows → Superpowers
The Problem
In the last long holiday, I was given Z.AI Coding Plan. At first, I was tempted to use it for Claude and opencode. I benchmarked it along with Qwen Code. After a while, I was tempted to build a good workflow for AI coding.
The few things that I think most of us who use LLM for coding run thru these problems:
| Problem | What Happens |
|---|---|
| Context bloat | Tool outputs flood the context window, eating capacity before any real work happens. Long process of development makes even the mighties Claude down. |
| Blind editing | Changes break things you didn’t know depended on the code you touched. |
| Chaotic workflows | Without enforced processes, results vary wildly between sessions. |
Thus, I make a new architecture for my coding plan. Each problem has a dedicated solution in my stack. Each solution is configured once in AGENTS.md and enforced automatically — the AI doesn’t get to opt out.
There are many tools to empower AI pipeline and solving the problems. I feel as long as these principles are there, we can make a good pipeline regardlesss the tools:
- Prompt Engineering.
- RAG.
- Context Engineering. Based on these principles I put these:
This article walks through my setup with the workflow at the center, and each layer explained by how it enables that workflow.
The Core — Skill-Driven Workflows
Without structure, AI assistants freestyle. Sometimes it writes tests first, sometimes it doesn’t. Sometimes it plans, sometimes it dives straight in. The results are inconsistent, and you end up babysitting the session instead of getting work done.
Don’t let the AI improvise. Enforce a structured pipeline where skills activate in sequence and the AI can’t skip steps.
The Superpowers Pipeline
Skills follow a priority hierarchy. Process skills fire first because they determine how to approach the task. Implementation skills guide execution. Review skills ensure quality:
- Process skills — brainstorming, systematic-debugging, TDD, writing-plans. These determine HOW to approach the task.
- Implementation skills — frontend-design, find-docs, accessibility-a11y. These guide execution.
- Review skills — verification-before-completion, requesting-code-review. These ensure quality.
The Brainstorming Flow
When I type /brainstorming add a dark mode toggle, the skill:
- Asks clarifying questions one at a time (scope, constraints, preferences)
- For UI work, requests a design reference (Figma mockup, reference site, HTML sketch)
- Generates a structured implementation plan via
writing-plans - Offers execution choice: subagents (parallel) vs current session (sequential)
- Runs
TDDper task - Triggers
verification(tests, lint, impact check) - Hands off to
finishing(review, commit, merge)
Greenfield vs Brownfield
The pipeline looks different depending on whether you’re starting from scratch or working in an existing codebase:
| Aspect | Greenfield | Brownfield |
|---|---|---|
| First step | Define requirements | Understand existing code |
| Before editing | No existing deps | MUST run gitnexus_impact |
| Risk | LOW | HIGH |
| Debugging | Rarely needed | Primary concern |
| Refactoring | Minimal | Critical for safety |
Configuration
{ "plugin": [ "superpowers@git+https://github.com/obra/superpowers.git" ]}Installation:
Fetch and follow instructions from https://raw.githubusercontent.com/obra/superpowers/refs/heads/main/.opencode/INSTALL.mdKey point: This pipeline is the core. Every other layer exists to make it work reliably.
Layer 1 — Current Information (Context7 + Tavily)
Skills need accurate information. Outdated docs = hallucinated code = broken tests. This is the RAG foundation of the workflow.
The Problem
Models trained 6 months ago don’t know about Astro 6 breaking changes or Tailwind v4 APIs. They hallucinate confidently.
The Philosophy
Skills should query live docs, not rely on stale training data.
Context7 — Live Library Documentation
Context7 solves this by providing a CLI that queries live library documentation on demand. The AI runs a resolve step to find the right library, then queries current docs. No stale training data, no guessing.
Installation:
bun i -g ctx7ctx setup # installs find-docs skillctx loginHow it works:
ctx7 library <name> "<question>"— find the right library IDctx7 docs <libraryId> "<question>"— get current docs
The find-docs skill provides the same workflow for contexts where the AI uses its native skill system. Both enforce the same pattern: resolve first, then query.
Tavily — Web Research Escalation
The web research problem splits into distinct modes: sometimes you need a quick answer, sometimes you need to pull content from a known URL, and sometimes you need a full multi-source analysis with citations.
Installation:
curl -fsSL https://cli.tavily.com/install.sh | bashtvly logintvly skills installEscalation pattern:
The seven Tavily skills:
| Skill | Command | When It Fires |
|---|---|---|
tavily-search | tvly search | No URL — find pages, answer questions |
tavily-extract | tvly extract | Have URL — pull content as markdown |
tavily-map | tvly map | Large site — discover URLs |
tavily-crawl | tvly crawl | Bulk content from site section |
tavily-research | tvly research | Deep multi-source analysis |
tavily-cli | tvly <command> | General reference |
tavily-best-practices | (reference) | Production patterns |
Why This Enables the Workflow
The writing-plans skill generates accurate implementation steps when it has current docs. The brainstorming skill answers questions correctly when it can research live.
Layer 2 — Context Protection (context-mode)
Skills need clean context to work. A flooded context window breaks the pipeline.
The Problem
Raw MCP tool outputs dump directly into context. A single Playwright snapshot is 56 KB. Five of those and the session dies before the skill pipeline can complete.
The Philosophy
Raw data should never enter the context window unless you’re editing it.
The Solution — context-mode
context-mode is an MCP plugin that intercepts tool outputs and routes them through an isolated subprocess. Only a condensed summary enters the context window. The full data stays in a searchable FTS5 database, available on demand through query tools.
Configuration
{ "plugin": ["superpowers@...", "context-mode"], "mcp": { "context-mode": { "type": "local", "command": ["context-mode"] } }}AGENTS.md Routing Rules
The plugin alone isn’t enough. The real enforcement comes from routing rules written into AGENTS.md:
| Rule | What’s Blocked | What You Use Instead |
|---|---|---|
| curl/wget | Shell HTTP calls | ctx_fetch_and_index or ctx_execute |
| Inline HTTP | fetch(), requests.get() in shell | ctx_execute sandbox |
| Shell >20 lines | Raw command output in context | ctx_batch_execute or ctx_execute |
Tool Hierarchy
- GATHER:
ctx_batch_execute— run multiple commands + search in ONE call. This is the primary tool. One call replaces 30+ individual tool invocations. - FOLLOW-UP:
ctx_search— query previously indexed content with natural language. - PROCESSING:
ctx_execute/ctx_execute_file— run code in a sandboxed subprocess. Only stdout enters context. - WEB:
ctx_fetch_and_index— fetch a URL, convert to markdown, chunk, index, then query. Raw HTML never touches context. - INDEX:
ctx_index— store arbitrary content in the FTS5 knowledge base for later retrieval.
Why This Enables the Workflow
Without context protection, the skill pipeline dies halfway through. ctx_batch_execute lets the brainstorming and writing-plans skills research your codebase without burning the session.
For the deep dive on how context-mode works, see my earlier article.
Layer 2 — Code Intelligence (GitNexus)
Skills need accurate code understanding. TDD and refactoring skills break things if they don’t know what depends on what.
The Problem
In a brownfield project, editing a function without knowing what calls it is Russian roulette. You fix one thing and break three others.
The Philosophy
Never edit code without understanding its blast radius.
The Solution — GitNexus
GitNexus builds a knowledge graph of your codebase from git history and AST analysis. Functions, classes, imports, call chains — everything becomes a queryable graph. Instead of grepping for callers and hoping you found them all, you ask the graph and get an exact answer with blast radius estimates.
Configuration
{ "mcp": { "gitnexus": { "type": "local", "command": ["npx", "-y", "gitnexus", "mcp"] } }}AGENTS.md Enforcement Rules
These aren’t suggestions. They’re checked before every edit and every commit:
- MUST run
gitnexus_impactbefore editing any symbol - MUST run
gitnexus_detect_changesbefore committing - MUST warn if impact analysis returns HIGH or CRITICAL risk
- NEVER edit a function, class, or method without impact analysis first
- NEVER rename symbols with find-and-replace — use
gitnexus_renameinstead
Tool Mappings
| Question | Tool | What It Returns |
|---|---|---|
| ”How does auth work?” | gitnexus_query | Execution flows ranked by relevance |
| ”Who calls this function?” | gitnexus_context | 360° view: callers, callees, processes |
| ”What breaks if I change this?” | gitnexus_impact | Blast radius by depth (d=1, d=2, d=3) |
| “Did my changes affect anything unexpected?” | gitnexus_detect_changes | Changed symbols + affected processes |
Risk Levels
| Depth | Meaning | Action |
|---|---|---|
| d=1 | WILL BREAK — direct callers | MUST update |
| d=2 | LIKELY AFFECTED — indirect deps | Should test |
| d=3 | MAY NEED TESTING — transitive | Test if critical path |
Why This Enables the Workflow
The TDD and verification skills can’t work safely without knowing what they’re affecting. gitnexus_impact runs automatically before edits. gitnexus_detect_changes confirms scope before finishing merges.
Practical Note
After committing, the GitNexus index goes stale. Run npx gitnexus analyze to refresh it. If the index previously included embeddings, add --embeddings to preserve them.
Layer 3 — Code Intelligence (GitNexus)
Skills need accurate code understanding. TDD and refactoring skills break things if they don’t know what depends on what.
The Problem
In a brownfield project, editing a function without knowing what calls it is Russian roulette. You fix one thing and break three others.
The Philosophy
Never edit code without understanding its blast radius.
The Solution — GitNexus
GitNexus builds a knowledge graph of your codebase from git history and AST analysis. Functions, classes, imports, call chains — everything becomes a queryable graph. Instead of grepping for callers and hoping you found them all, you ask the graph and get an exact answer with blast radius estimates.
Configuration
{ "mcp": { "gitnexus": { "type": "local", "command": ["npx", "-y", "gitnexus", "mcp"] } }}AGENTS.md Enforcement Rules
These aren’t suggestions. They’re checked before every edit and every commit:
- MUST run
gitnexus_impactbefore editing any symbol - MUST run
gitnexus_detect_changesbefore committing - MUST warn if impact analysis returns HIGH or CRITICAL risk
- NEVER edit a function, class, or method without impact analysis first
- NEVER rename symbols with find-and-replace — use
gitnexus_renameinstead
Tool Mappings
| Question | Tool | What It Returns |
|---|---|---|
| ”How does auth work?” | gitnexus_query | Execution flows ranked by relevance |
| ”Who calls this function?” | gitnexus_context | 360° view: callers, callees, processes |
| ”What breaks if I change this?” | gitnexus_impact | Blast radius by depth (d=1, d=2, d=3) |
| “Did my changes affect anything unexpected?” | gitnexus_detect_changes | Changed symbols + affected processes |
Risk Levels
| Depth | Meaning | Action |
|---|---|---|
| d=1 | WILL BREAK — direct callers | MUST update |
| d=2 | LIKELY AFFECTED — indirect deps | Should test |
| d=3 | MAY NEED TESTING — transitive | Test if critical path |
Why This Enables the Workflow
The TDD and verification skills can’t work safely without knowing what they’re affecting. gitnexus_impact runs automatically before edits. gitnexus_detect_changes confirms scope before finishing merges.
Practical Note
After committing, the GitNexus index goes stale. Run npx gitnexus analyze to refresh it. If the index previously included embeddings, add --embeddings to preserve them.
Layer 4 — Vision (agent-browser + zai-mcp-server)
Skills need to see what users see. Terminal-based AI is blind to UI bugs and error dialogs.
The Problem
You paste descriptions like “there’s a red box with some text” and hope the AI understands. It can’t see the broken layout.
The Philosophy
Skills should diagnose from screenshots, not descriptions.
The Solution — Two-Stage Pipeline
agent-browser— captures browser screenshotszai-mcp-server— analyzes (OCR, error diagnosis, UI diff)
Configuration
bun i -g agent-browseragent-browser installnpx skills add https://github.com/vercel-labs/agent-browser --skill agent-browser -y -gWhy This Enables the Workflow
The verification skill can compare the implemented UI against the design reference from brainstorming. Instead of “does it look right?”, it’s “here’s the pixel diff.”
Layer 5 — The Model Provider (Z.ai)
The engine that powers everything.
The Problem
Not all tasks need a frontier model. Routing, summarization, and classification waste money on overpowered models.
The Philosophy
Dual-model setup — right tool for each job.
Configuration
{ "model": "zai-coding-plan/glm-5-turbo", "small_model": "zai-coding-plan/glm-4.5-air"}Model Roles
| Slot | Model | Use Case |
|---|---|---|
model | glm-5-turbo | Main reasoning, code generation, complex tasks |
small_model | glm-4.5-air | Fast/cheap: summarization, classification, routing |
MCP Servers
| Tool | What It Does |
|---|---|
zai-mcp-server | Vision: screenshot-to-code, OCR, error diagnosis, UI diff |
web-search-prime | Web search (Chinese + international) |
web-reader | Fetch URL → clean markdown |
zread | Search GitHub repos — docs, issues, commits, files |
Why This Enables the Workflow
The skill pipeline runs cheaper when routing and summarization use glm-4.5-air. Complex reasoning and code generation fire glm-5-turbo only when needed.
How It All Fits Together
Walkthrough: “Add a dark mode toggle”
- Current docs (RAG):
ctx7fetches Tailwind v4 dark mode docs (not hallucinated v3 APIs) - Superpowers core activates:
/brainstormingasks clarifying questions one at a time - Context protection: Research runs through
ctx_batch_execute→ctx_search, no bloat - Code intelligence:
gitnexus_queryfinds existing theme code,gitnexus_contextshows dependencies - Safety check:
gitnexus_impactshows blast radius before any edit - TDD skill: Writes test first, then implementation
- Vision verification:
agent-browsercaptures screenshot,zai-mcp-servercompares to design reference - Final check:
gitnexus_detect_changesconfirms scope, tests pass - Finishing: Review, commit, merge
Closing
The solutions that I put here is not mandatory. I used them because they were the ones that available. If you are also broke-gang fam, you can use:
- Custom MCP/skills to use Qwen code to read image.
- Use opencode Minimax M2.5 or any free Openrouter
Appendix: Interface (Optional)
Default keybinds fight against your muscle memory. Your TUI config is your IDE, not just decoration.
Configuration Highlights from tui.json
- Leader key:
ctrl+x(Emacs-style) - Input motions:
ctrl+b/ctrl+f(word),ctrl+a/ctrl+e(line) - Session management:
<leader>n(new),<leader>l(list),<leader>g(timeline) - Agent cycling:
Tab/Shift+Tab
Key Highlights
| Key | Action |
|---|---|
ctrl+x | Leader (prefix) |
ctrl+x n | New session |
ctrl+x l | Session list |
ctrl+x g | Session timeline |
ctrl+x x | Export session |
Tab | Cycle agents |
ctrl+p | Command palette |
References
| Tool | Author | What It Does |
|---|---|---|
| OpenCode | Anomaly | The AI coding assistant this entire setup runs on |
| Context7 | Context7 | Live library documentation retrieval via CLI |
| Superpowers | obra | Plugin that provides skill-driven workflows and process enforcement |
| context-mode | mksglu | MCP plugin that protects the context window from tool output bloat |
| GitNexus | mikenye | Code intelligence — knowledge graph, blast radius analysis, safe refactoring |
| agent-browser | Vercel | Browser automation for AI agents |
| Tavily | Tavily | Web search, extraction, crawling, and deep research for AI agents |
| Z.ai MCP Server | Z.ai | Vision, web search, web reader, GitHub integration |
This article was written by opencode (GLM-5-Turbo | Z.AI Coding Plan) and edited by Qwen Code (Qwen 3.5 | Alibaba). I cheated by edited some part just to make it clear and not to exaggerate things.


