跪拜 Guibai
← All articles
Claude · OpenAI · AI Programming

A Two-Year AI Workflow Finally Works, Thanks to Opus 4.8

By 寅时码 ·
Read original on juejin.cn ↗ Google Translate ↗ Alt translation

The gap between writing AI rules and having the model actually follow them has been the central frustration of AI-assisted coding. Opus 4.8 crosses a threshold where evidence-based verification rules stop being aspirational and start reshaping the entire development workflow — from how the model searches for information to how it tests its own changes.

Summary

The same `CLAUDE.md` rules that older models ignored now produce a fundamentally different behavior in Opus 4.8: the model actively doubts itself, uses `gh api` to pull real source code for verification, and leaves `@TODO` markers instead of fabricating APIs. This shift from guessing to verifying forced a complete rethinking of the AI's research pipeline — where it looks, how it reads code, and how it tests its own output.

The resulting system replaces the built-in web search with a five-tier routing skill (Context7 docs → GitHub repo → code search → Exa → fallback), uses shallow git clones for deep source reading, and exposes the editor's live LSP server to the AI so it queries real symbol definitions instead of grepping for strings. A `feasibility` skill blocks any code change until a structured report with explicit ✅/⚠️/❌ conclusions is approved, and a `how-to-test` skill delivers a single runnable command with expected pass/fail counts — or honestly states that a test isn't worth writing.

Hooks replace Claude Code's prefix-based permission system with tree-sitter AST parsing to catch compound command bypasses, auto-format every write via ESLint and LSP, and fire desktop notifications when tasks complete or need attention. The whole configuration, including a code-review skill that grades six dimensions of code quality without touching the code, is available as a drop-in dotfiles repo.

Takeaways
A five-tier search routing skill (Context7 → gh CLI → gh-grep → Exa → Web Search) prevents the model from immediately hitting general web search, which returns SEO spam and burns tokens on page noise.
Shallow git clones (`--depth=1 --single-branch --no-tags`) into `/tmp` let the AI read 5+ source files or cross-reference directories far more efficiently than repeated `gh api` calls.
Exposing the editor's live LSP server to the AI via MCP lets it query real symbol definitions, references, and call hierarchies instead of relying on grep, which confuses string matches with actual code references.
A `feasibility` skill blocks all code changes until a structured report with explicit ✅/⚠️/❌ conclusions is approved, preventing wasted implementation on architecturally impossible ideas.
The `how-to-test` skill outputs a single copy-paste command with expected pass/fail counts, and is explicitly allowed to say 'this isn't worth testing' to avoid fake green-light assertions.
Replacing Claude Code's built-in permission system with a PreToolUse hook that parses Bash via tree-sitter AST catches compound command bypasses (`cd /other && git push`) that prefix-matching misses.
Disabling `unused-imports` and `prefer-const` lint rules during auto-formatting prevents infinite loops where the AI adds an import in one step and the formatter deletes it before the next step uses it.
The `invoke-plan` skill was downgraded from 'use for complex tasks' to 'only for multi-session or phased work' because current models now handle multi-file changes without needing explicit plan files.
Context handovers via a `/summary` skill that explicitly requires stating current bugs and failures prevent the model from whitewashing broken state when starting a fresh conversation.
Conclusions

The entire workflow is predicated on a single behavioral shift in Opus 4.8 — active self-doubt and verification — that no amount of prompt engineering could reliably produce in earlier models. The rules didn't change; the model's willingness to comply did.

Routing search through a fixed priority chain (docs first, general web last) is a form of capability restriction that paradoxically increases reliability. The model is worse at choosing where to look than at looking once the destination is chosen.

Using the editor's existing LSP process rather than spawning a separate language server instance is a zero-memory-cost integration that most MCP-based approaches miss. The LSP is already running and already indexed the project.

The `how-to-test` skill's most important feature is permission to decline writing tests. Without an explicit 'this is not worth testing' escape hatch, models default to writing assertions against implementation details that pass forever and catch nothing.

Tree-sitter AST parsing for command allowlisting is a materially different security posture than prefix matching. A regex or prefix check sees `cd /safe && rm -rf /` as safe; an AST sees two separate command nodes and can block the second.

Disabling specific lint rules during auto-formatting acknowledges that AI writes code incrementally across multiple turns — an import added now may be used in the next message, and a `let` declared now may be reassigned later. Static linting assumptions break under incremental generation.

Concepts & terms
LSP (Language Server Protocol)
A protocol that decouples language intelligence (go-to-definition, find-references, diagnostics) from the editor into a separate process. The editor and language server communicate via JSON-RPC, so one server like `tsserver` works across VSCode, Neovim, and Emacs.
MCP (Model Context Protocol)
A protocol for exposing external tools and data sources to AI models. Each MCP server registers its tools, input schemas, and output schemas with the model at startup, consuming context tokens proportional to the number of tools registered.
Tree-sitter
An incremental parsing library that builds concrete syntax trees for code. Used in the PreToolUse hook to parse Bash commands into an AST, so compound commands like `cmd1 && cmd2` can be inspected as separate nodes rather than matched as a single string.
Shallow clone
A `git clone` with `--depth=1` that pulls only the latest commit snapshot without history. Combined with `--single-branch` and `--no-tags`, it minimizes download size for AI source-code reading where only the current state matters.
Progressive disclosure
A skill design pattern where the main `SKILL.md` file contains only essential instructions, while detailed references and scripts live in subdirectories. The main file is always loaded into context; detail files are only read when the model determines they're needed.
Source: juejin.cn ↗ Google Translate ↗ Backup ↗