diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml
new file mode 100644
index 0000000..409cc12
--- /dev/null
+++ b/.github/workflows/docs.yml
@@ -0,0 +1,64 @@
+name: Docs
+
+# Every PR and main push builds the MkDocs Material site to validate it;
+# pushes to main additionally deploy the HTML to GitHub Pages. Docs track
+# main (latest), independent of the tag-driven release.yml flow.
+on:
+ push:
+ branches: [main]
+ paths:
+ - 'docs/**'
+ - 'src/dashscope_agenticx/**'
+ - 'mkdocs.yml'
+ - 'requirements-doc.txt'
+ - '.github/workflows/docs.yml'
+ pull_request:
+ paths:
+ - 'docs/**'
+ - 'src/dashscope_agenticx/**'
+ - 'mkdocs.yml'
+ - 'requirements-doc.txt'
+ - '.github/workflows/docs.yml'
+ workflow_dispatch:
+
+permissions:
+ contents: read
+
+concurrency:
+ group: pages-${{ github.ref }}
+ cancel-in-progress: true
+
+jobs:
+ build:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v4
+ - uses: actions/setup-python@v5
+ with:
+ python-version: '3.12'
+ # mkdocstrings imports the real package, so install it alongside the
+ # doc toolchain. Core dependencies suffice: every Reference target
+ # guards optional imports (textual/playwright/etc.) lazily.
+ - run: python -m pip install -r requirements-doc.txt .
+ - name: Build HTML
+ run: mkdocs build --strict
+ - name: Upload site artifact
+ if: github.event_name == 'push' && github.ref == 'refs/heads/main'
+ uses: actions/upload-pages-artifact@v3
+ with:
+ path: site
+
+ deploy:
+ needs: build
+ if: github.event_name == 'push' && github.ref == 'refs/heads/main'
+ runs-on: ubuntu-latest
+ permissions:
+ pages: write
+ id-token: write
+ environment:
+ name: github-pages
+ url: ${{ steps.deployment.outputs.page_url }}
+ steps:
+ - name: Deploy to GitHub Pages
+ id: deployment
+ uses: actions/deploy-pages@v4
\ No newline at end of file
diff --git a/.gitignore b/.gitignore
index 88712d7..200d356 100644
--- a/.gitignore
+++ b/.gitignore
@@ -34,6 +34,8 @@ Thumbs.db
*.webm
*.wav
*.mp3
+# Docs site assets are intentional, not test artifacts
+!docs/assets/*.png
# npm side products (agenticx isn't a Node project; ignore stray init artifacts)
node_modules/
@@ -49,3 +51,7 @@ package-lock.json
/md/
/.aoneci/
/.gitlab-ci.yml
+
+# MkDocs build output and local docs virtualenv
+/site
+.venv-docs/
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 32b2ff8..fec7ab6 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -15,6 +15,9 @@ repos:
- id: check-ast
- id: sort-simple-yaml
- id: check-yaml
+ # mkdocs.yml uses !!python/name: tags for the Material emoji
+ # extension; the safe loader rejects them.
+ args: [--unsafe]
exclude: |
(?x)^(
meta.yaml
diff --git a/CHANGELOG.md b/CHANGELOG.md
index e097ee6..2fe9ed6 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,6 +5,29 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
+## [1.0.2] - 2026-11-19
+
+### Added
+
+- Bilingual (English / 中文) MkDocs Material documentation site under `docs/`:
+ quickstart, configuration, CLI and slash-command reference, migration,
+ embedding SDK / tools & skills / subagents & memory / security & platform
+ guides, developer guide, about, release notes, and an API reference built
+ from source with mkdocstrings.
+- GitHub Actions workflow building the site with `mkdocs build --strict` on
+ pull requests and deploying to GitHub Pages on pushes to `main`.
+- README documentation-site links pointing to the published bilingual docs.
+
+### Changed
+
+- The doc-code consistency guard accepts the remote DashScope logo URL used
+ by the READMEs.
+
+### Fixed
+
+- Browser tool docstring argument indentation so the API reference parses
+ cleanly under `mkdocs build --strict`.
+
## [1.0.1] - 2026-11-11
### Added
diff --git a/README.md b/README.md
index 7278bc2..6ff9147 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
# DashScope AgenticX
-
+
[English](README.md) | [中文](README_zh.md)
@@ -264,8 +264,13 @@ tests alone does not publish or certify a final 1.0 release.
## Documentation
+The bilingual documentation site (English / 中文) is published at
+ — guides, configuration,
+CLI reference, and API reference. Source pages live under [`docs/`](docs/).
+
| Document | Contents |
|---|---|
+| [Documentation site](https://dashscope.github.io/dashscope-agenticx/) / [中文文档](https://dashscope.github.io/dashscope-agenticx/zh/) | Bilingual guides, configuration, CLI, and API reference |
| [User guide](user-guide.md) / [中文手册](user-guide_zh.md) | Full commands, configuration, tools, modules, and development reference |
| [Migration](migration-to-1.0.md) | Legacy naming, directories, credentials, and compatibility |
| [Changelog](CHANGELOG.md) | 1.0 release notes, upcoming changes, and archived release history |
diff --git a/README_zh.md b/README_zh.md
index de736bc..f7726f0 100644
--- a/README_zh.md
+++ b/README_zh.md
@@ -1,6 +1,6 @@
# DashScope AgenticX
-
+
[English](README.md) | [中文](README_zh.md)
@@ -242,8 +242,13 @@ App 校验和供应链检查是独立发布要求;本地单测通过不等于
## 文档
+双语文档站(English / 中文)发布于
+,包含专题指南、配置、
+命令行参考与 API 参考。源码页面位于 [`docs/`](docs/)。
+
| 文档 | 内容 |
|---|---|
+| [文档站](https://dashscope.github.io/dashscope-agenticx/) / [English docs](https://dashscope.github.io/dashscope-agenticx/) | 双语指南、配置、命令行与 API 参考 |
| [中文使用手册](user-guide_zh.md) / [English guide](user-guide.md) | 完整命令、配置、工具、模块和开发参考 |
| [迁移指南](migration-to-1.0.md) | 旧命名、目录、凭据和兼容处理 |
| [Changelog](CHANGELOG.md) | 1.0 发布说明、后续改动和归档的历史版本 |
diff --git a/RELEASE.md b/RELEASE.md
index dc0c378..f62f389 100644
--- a/RELEASE.md
+++ b/RELEASE.md
@@ -1,6 +1,6 @@
# Release Process
-The release version is `1.0.1`. Updating the version and pushing or merging
+The release version is `1.0.2`. Updating the version and pushing or merging
Git branches does not publish packages or create release tags. External
publication requires the checks and explicit approval below.
@@ -15,7 +15,7 @@ publication requires the checks and explicit approval below.
metadata, and `agenticx --version` agree.
6. Only when external publication is explicitly approved, tag `v` and
publish the `dashscope-agenticx` wheel/sdist plus checksums and SBOM.
-7. Archive the migration guide and final benchmark/eval reports for `1.0.1`.
+7. Archive the migration guide and final benchmark/eval reports for `1.0.2`.
Main-branch pushes and pull requests run unit tests and pre-commit checks.
Before pushing a release tag, confirm the tagged source passed those checks.
diff --git a/SECURITY.md b/SECURITY.md
index 8171960..34b12e0 100644
--- a/SECURITY.md
+++ b/SECURITY.md
@@ -2,7 +2,7 @@
## Supported versions
-Security fixes target the active `1.0.1` release line.
+Security fixes target the active `1.0.2` release line.
## Reporting
diff --git a/docs/assets/favicon.png b/docs/assets/favicon.png
new file mode 100644
index 0000000..c8de919
Binary files /dev/null and b/docs/assets/favicon.png differ
diff --git a/docs/assets/logo.svg b/docs/assets/logo.svg
new file mode 100644
index 0000000..689c875
--- /dev/null
+++ b/docs/assets/logo.svg
@@ -0,0 +1,7 @@
+
diff --git a/docs/en/about.md b/docs/en/about.md
new file mode 100644
index 0000000..507c5b0
--- /dev/null
+++ b/docs/en/about.md
@@ -0,0 +1,76 @@
+---
+description: "About DashScope AgenticX: identity, requirements, scope, and project boundaries."
+---
+# About AgenticX
+
+**DashScope AgenticX** is a Python Agent Runtime for building and running
+domain experts. It connects models, tools, Skills, permissions, and
+persistent sessions through one runtime, with a terminal interface and APIs
+for embedded applications.
+
+Current version: **{{ agenticx_version }}**.
+
+## Identity
+
+| Aspect | Value |
+|---|---|
+| Product | AgenticX / DashScope AgenticX |
+| Distribution | [`dashscope-agenticx`](https://pypi.org/project/dashscope-agenticx/) |
+| Import namespace | `dashscope_agenticx` |
+| Command | `agenticx` (no official short alias) |
+| Workspace | `.agenticx/` |
+| Environment | `AGENTICX_*` |
+| Global app name | `AgenticX` (platform-standard directory via `platformdirs`) |
+| License | MIT |
+| Source | [github.com/dashscope/dashscope-agenticx](https://github.com/dashscope/dashscope-agenticx) |
+
+The bare `agenticx` PyPI distribution is a **different, unrelated project**.
+Install `dashscope-agenticx`.
+
+## Requirements
+
+- **Python 3.10+** for the core Runtime, CLI, and SDK.
+- The Pillow-backed `vision` and `media` extras require **Python 3.11+**;
+ the `all` extra omits Pillow on Python 3.10.
+- A model provider API key for cloud providers (e.g. `DASHSCOPE_API_KEY`
+ for the default Tongyi/DashScope provider), or a local provider such as
+ `ollama` for fully offline use.
+- Optional capabilities (TUI, provider SDKs, web, browser, voice, camera)
+ are installed as extras and are not prerequisites for the core Runtime.
+
+CI tests Python 3.10–3.13 with Ubuntu/macOS/Windows smoke checks. Those
+checks are not a guarantee that every optional device or sandbox backend
+works on every OS.
+
+## What AgenticX is
+
+- A local assistant you run directly in a terminal.
+- An embeddable Python runtime (`run_once`, `run_events`, `create_agent`,
+ `RuntimeBuilder`) for application integration.
+- A packaging layer for domain experts as versioned App Bundles, with
+ DashScope SDK Expert and Bailian Expert as bundled templates.
+
+## What AgenticX is not
+
+- **Not a hosted service.** It runs in your process; the localhost Server
+ is a token-authenticated local API, not an Internet-facing deployment.
+- **Not a hardened OS sandbox.** OS sandbox support (Seatbelt/bubblewrap)
+ is defense in depth; availability and limitations depend on the backend.
+- **Not a complete workflow platform.** Voice, camera, browser, web search,
+ scheduler, and experimental features are optional.
+
+A checksum proves content identity, not publisher authenticity; a local
+trust flag is not a verified digital signature. Read the
+[security guide](guides/security-and-platform.md) and the repository
+`SECURITY.md` before installing third-party applications.
+
+## Dependencies
+
+The core install stays small. Optional packs add provider SDKs, the Textual
+TUI, web/browser tooling, and media (voice/camera/vision) dependencies.
+Installing dependencies does not grant an App permissions. See
+[Quickstart](quickstart.md#optional-extras) for the extras table.
+
+## License
+
+MIT, as declared in `pyproject.toml`.
\ No newline at end of file
diff --git a/docs/en/cli.md b/docs/en/cli.md
new file mode 100644
index 0000000..c7a69b8
--- /dev/null
+++ b/docs/en/cli.md
@@ -0,0 +1,133 @@
+---
+description: "AgenticX CLI options, subcommands, and the complete slash command reference."
+---
+# CLI & Commands
+
+## Startup options
+
+```shell
+agenticx # interactive session (TUI if installed)
+agenticx --cli # inline REPL with native scrollback
+agenticx --tui # force the Textual interface
+agenticx -c "Summarize this project" # one prompt, then exit
+agenticx --dry-run # preview loaded configuration
+agenticx --protocol anthropic # startup protocol: openai (default) / anthropic
+agenticx --max-turns 20 # override the conversation turn limit
+agenticx --version
+```
+
+## Subcommands
+
+```shell
+agenticx app list # versioned App Bundles
+agenticx app install # install + permission diff preview
+agenticx app info # publisher, permissions, runtime range, checksum
+agenticx app verify # checksum + runtime compatibility
+agenticx app update # reinstall from the recorded source
+
+agenticx expert # list expert templates
+agenticx expert download # merge an expert profile into ./.agenticx/
+agenticx expert restore # undo the most recent merge
+
+agenticx mcp-server # expose tools over MCP stdio (trusted clients only)
+agenticx serve --token # localhost Client API (default 127.0.0.1:8765)
+```
+
+`app install` registers the bundle under `.agenticx/apps/` but does not
+activate its profile; expert downloads are role/configuration data, not
+registered Apps. See
+[Tools, Skills & Experts](guides/tools-and-skills.md#experts) and
+[Security, Platform & MCP](guides/security-and-platform.md#local-http-api).
+
+## Slash commands
+
+Commands are organized in four tiers: Session → Configuration →
+Capability → Development. `/help` lists them in this order.
+
+### Session
+
+| Command | Description |
+|---|---|
+| `/help` | Show help, grouped by category |
+| `/clear` | Clear conversation history (persists the empty history) |
+| `/info` | Runtime info: provider/model/protocol/base URL/capabilities/privacy |
+| `/copy` | Copy the last reply to the clipboard |
+| `/save [path]` | Save the last reply to a file |
+| `/json on\|off` | Force JSON replies (`response_format` passthrough) |
+| `/compress` | Replace history with an LLM summary to save tokens |
+| `/summarize` | Summarize the current task into experience memory |
+| `/stats` | Token usage, prompt composition, API/tool counts, duration |
+| `/report` | Trace performance report (calls, success rate, latency) |
+| `/feedback good\|bad` | Mark task satisfaction (experience memory) |
+| `/history [subcmd]` | History stats/list/search/export/clear |
+| `/undo` | Undo the last file write/delete (checkpoint snapshots) |
+| `/session [subcmd]` | Topics: new/list/switch/rename/fork/remove/scene |
+| `/privacy [on\|off\|status]` | Privacy mode |
+| `/audit [subcmd]` | Audit log: recent/query/clear |
+| `/voice [subcmd]` | Voice input: on/off/model/silence/max/threshold |
+| `/tts [subcmd]` | Voice output: on/off/model/voice/speed/say/last |
+| `/camera capture\|record` | Camera photo / video (media extras) |
+| `/log [subcmd]` | Full prompts recorded under `/debug on`: tail/search/clear |
+| `/trace [subcmd]` | Execution trace: tail/search/clear |
+| `/exit` | Exit (aliases `/quit`, `/q`) |
+
+`/v` is the voice-input shortcut (`Ctrl+T`): record → ASR → send.
+
+### Configuration
+
+| Command | Description |
+|---|---|
+| `/setup` | Interactive workspace initialization wizard |
+| `/provider` | Wizard: provider → model → connection → API key |
+| `/model [name]` | Switch model within the current provider |
+| `/capability [subcmd]` | list/enable/disable/reload/config |
+| `/subagents [subcmd]` | list/reload/enable/disable/config |
+| `/trust [subcmd]` | This turn's tool trust cache: list/clear/allow/deny |
+| `/rule [subcmd]` | Long-lived operation rules: list/add/remove/edit/enable/disable/clear |
+| `/theme [subcmd]` | list/set/custom colors (dark/light/monokai/dracula/nord/solarized) |
+| `/debug [on\|off\|status]` | Record full sanitized prompts to the session trace |
+| `/directives [subcmd]` | Custom directives + auto-learning proposals/accept/reject |
+
+### Capability
+
+| Command | Description |
+|---|---|
+| `/profile [subcmd]` | User profile: list/search/add/remove/clear |
+| `/memory [subcmd]` | Conversation history memory: list/search/remove/clear |
+| `/mcp [subcmd]` | MCP services: add/remove/list (requires `bailian.mcp`) |
+| `/skill [name] [args]` | List or invoke skills |
+| `/skill install\|link\|update\|uninstall` | Skill package lifecycle |
+| `/skill search\|publish\|reload` | Registry search, packaging, rescan |
+| `/skill enable\|disable ` | Force skill package state |
+| `/app list\|info\|install\|update\|verify` | Versioned App Bundle management |
+| `/cron [subcmd]` | Scheduled tasks: add/list/remove/pause/resume |
+
+Commands for disabled capabilities are intercepted with an enable hint
+instead of failing on credentials.
+
+### Development
+
+| Command | Description |
+|---|---|
+| `/dev model add\|rm\|list` | Register models at runtime |
+| `/dev provider add\|list\|rm` | Extend providers |
+| `/dev capability add\|list\|rm` | Extend HTTP tool groups |
+| `/dev skill add\|list\|rm` | Extend skills |
+| `/dev tool add\|list\|rm` | Extend shell tools |
+| `/dev debug tools\|schema\|call\|prompt` | Debugging helpers |
+| `/dev test provider ` | Test provider connectivity |
+| `/dev reload` | Hot-reload `custom-extensions.toml` |
+| `/dev log` | Tool registration statistics |
+| `/expert [list]` | List expert templates |
+| `/expert download ` | Merge an expert into `./.agenticx/` (backup on conflict) |
+| `/expert restore` | Undo the most recent merge |
+
+## Terminal output
+
+- Markdown replies with numbered turns; tool details collapse by
+ default (`Ctrl+O` toggles), failures stay expanded.
+- `Ctrl+G` expands token/API/tool/prompt-composition statistics. Prompt
+ sizes are characters, not exact token counts.
+- Selection copying: `Cmd+C` on macOS, `Ctrl+C` on Windows/Linux; on
+ macOS `Ctrl+C` clears/cancels/quits instead. `/copy` copies the latest
+ reply source; `--cli` gives native scrollback.
\ No newline at end of file
diff --git a/docs/en/configuration.md b/docs/en/configuration.md
new file mode 100644
index 0000000..add93d7
--- /dev/null
+++ b/docs/en/configuration.md
@@ -0,0 +1,135 @@
+---
+description: "AgenticX layered configuration: global and workspace config.toml, environment variables, providers, and API key management."
+---
+# Configuration
+
+AgenticX uses **layered configuration**:
+
+- **Global** — the platform-standard `AgenticX` app directory
+ (`~/.config/AgenticX` on Linux; `AGENTICX_HOME` overrides it on any
+ platform): per-provider API key slots, voice/TTS settings, shared
+ across projects.
+- **Workspace** — `./.agenticx/config.toml`: provider, model, platform
+ capabilities, MCP services, username.
+
+Priority: **workspace config > global config > environment variables
+(fill empty slots only) > interactive input**. `AGENTICX_PROVIDER` and
+`AGENTICX_MODEL` always force-override. The same resolution is exposed
+programmatically as [`Config.load()`](reference/sdk.md#config).
+
+## Workspace config
+
+```toml
+# ./.agenticx/config.toml
+user_name = "agenticx"
+provider = "tongyi"
+model = "qwen3.8-flash"
+fallback_providers = "openai,anthropic" # tried in order on primary failure
+enabled_capabilities = "bailian.mcp,bailian.cli"
+max_turns = 100 # tool-call turns per conversation (default 50)
+session_persist = true # cross-session history persistence
+tui = false # false = inline CLI REPL instead of TUI
+user_directives = ["Don't push after each commit"] # written by /rule
+delegation = { max_concurrent = 5, default_timeout = 120 }
+
+[[mcp_servers]]
+service = "time"
+```
+
+The full field list with types and defaults is in the
+[Config reference](reference/sdk.md#config).
+
+## Global config & API keys
+
+Each provider has an independent key slot, so switching providers never
+overwrites another key. New secrets are stored in the OS keyring under
+the `dashscope-agenticx` service; TOML holds only references:
+
+```toml
+# ~/.config/AgenticX/config.toml
+tongyi_api_key = "KEYRING:v1:..."
+anthropic_api_key = "KEYRING:v1:..."
+openai_api_key = "KEYRING:v1:..."
+```
+
+The `/provider` wizard enters keys without terminal echo and offers
+three sources: OS keyring, environment variable, or configure later.
+Legacy single `api_key` lines are migrated to the current provider's
+slot on first launch; legacy `ENC:` values remain readable for
+migration but are never written for new secrets.
+
+## Environment variables
+
+API-key variables only fill empty slots; `AGENTICX_PROVIDER` /
+`AGENTICX_MODEL` always override.
+
+| Variable | Description |
+|---|---|
+| `DASHSCOPE_API_KEY` | Tongyi / Bailian API key |
+| `ANTHROPIC_API_KEY` | Claude API key |
+| `OPENAI_API_KEY` | OpenAI API key |
+| `OPENAI_BASE_URL` | Custom OpenAI-compatible endpoint (highest priority) |
+| `AGENTICX_PROVIDER` | Force the provider |
+| `AGENTICX_MODEL` | Force the model |
+| `AGENTICX_MCP_SERVERS` | Pre-connect MCP services (comma-separated) |
+| `AGENTICX_MEMORY_USER_ID` | User identifier for profile isolation |
+| `AGENTICX_MEMORY_LIBRARY_ID` | Bailian profile library ID |
+| `AGENTICX_COMMAND_TIMEOUT` | `run_command` timeout seconds (default 600) |
+| `AGENTICX_HOME` | Override the global config directory |
+
+## Built-in providers
+
+| Provider | Protocol | Default model |
+|---|---|---|
+| `tongyi` | DashScope native | `qwen3.8-flash` |
+| `anthropic` | Anthropic Messages | `claude-sonnet-4-20250514` |
+| `openai` | OpenAI | `gpt-4o` |
+
+Switch with `/provider` (wizard) or `/model ` (model-only).
+Reasoning models (`reasoning_content`) are supported; the reasoning
+content is passed back on the next request to avoid provider 400s.
+
+## Custom providers
+
+DeepSeek, Kimi, Ollama, and any OpenAI/Anthropic-compatible endpoint are
+declared in `custom-extensions.toml` (workspace overrides global by
+`name`) — no code required:
+
+```toml
+# ./.agenticx/custom-extensions.toml
+[[providers]]
+name = "moonshot"
+base_url = "https://api.moonshot.cn/v1"
+api_key_env = "MOONSHOT_API_KEY" # env var name; no plaintext on disk
+default_model = "kimi-k2"
+protocol = "openai" # openai / anthropic / dashscope
+
+[[providers]]
+name = "ollama"
+base_url = "http://localhost:11434/v1"
+default_model = "llama3"
+protocol = "openai"
+auth = false # local, no key needed
+```
+
+Plaintext `api_key = "sk-..."` is rejected by the loader; use
+`api_key_env` or a `KEYRING:v1:` reference. `/dev provider add` writes
+these blocks interactively. See
+[Tools, Skills & Experts](guides/tools-and-skills.md#custom-tools)
+for HTTP tool groups, shell tools, and skills in the same file.
+
+**base_url precedence** (primary provider): `OPENAI_BASE_URL` env >
+`base_url` in `config.toml` > matching `[[providers]]` entry > built-in
+default. Fallback providers always use their own declared endpoint.
+
+## Workspace file map
+
+| File | Purpose |
+|---|---|
+| `.agenticx/config.toml` | Models, capabilities, interaction settings |
+| `.agenticx/system-prompt.md` | Domain role and behavioral instructions |
+| `.agenticx/skills/` | Markdown skills and skill packages |
+| `.agenticx/custom-extensions.toml` | Declarative providers and HTTP/shell tools |
+| `.agenticx/permissions.toml` | Tool/command allow-deny-confirm policy |
+| `.agenticx/hooks.toml` | Event hooks under trust and permission controls |
+| `.agenticx/session/` | Persistent conversations and run records |
\ No newline at end of file
diff --git a/docs/en/develop.md b/docs/en/develop.md
new file mode 100644
index 0000000..d618d84
--- /dev/null
+++ b/docs/en/develop.md
@@ -0,0 +1,94 @@
+---
+description: "Develop and contribute to DashScope AgenticX: environment setup, tests, lint, and the release contract."
+---
+# Developer Guide
+
+## Environment
+
+Use Python **3.10–3.13**. Install the package editable with the development
+and optional-feature extras:
+
+```bash
+python -m venv .venv
+source .venv/bin/activate # Windows: .venv\Scripts\Activate.ps1
+python -m pip install -e ".[dev,all]"
+python -m pip install pre-commit
+```
+
+`all` omits Pillow on Python 3.10 (the Pillow-backed `vision`/`media` extras
+require 3.11+). Core dependencies are intentionally small; new heavy
+dependencies belong in extras.
+
+## Tests and lint
+
+```bash
+python -m pytest tests/ -q # unit + e2e suite
+pre-commit run --all-files # Black, isort, flake8, encoding pragmas, …
+```
+
+Run Black, isort, and flake8 before submitting. The pre-commit config also
+enforces UTF-8 encoding pragmas, docstring-first ordering, and trailing-
+whitespace cleanup. `mkdocs.yml` uses `!!python/name:` tags, so the
+`check-yaml` hook runs with `--unsafe`.
+
+### Test layout
+
+- `tests/ut/` — unit tests, including `test_docs_consistency.py`, which
+ guards the root README/user-guide/migration/CHANGELOG contracts.
+- `tests/e2e/` — end-to-end runs against a fake provider
+ (`tests/e2e/fake_provider.py`), so the suite exercises the agent loop
+ offline without real cloud model calls.
+
+## Documentation site
+
+The bilingual docs site (this site) builds with MkDocs Material:
+
+```bash
+python -m venv .venv-docs
+source .venv-docs/bin/activate
+python -m pip install -r requirements-doc.txt -e .
+mkdocs serve # live preview at http://127.0.0.1:8000
+mkdocs build --strict # CI-equivalent build (warnings are errors)
+```
+
+English pages live at `docs/en/` (site root), Chinese at `docs/zh/`
+(`/zh/`). Reference pages use mkdocstrings `:::` identifiers resolved
+against `src/`; keep the en/zh `:::` blocks identical and translate only
+headings and prose. The version placeholder `{{ agenticx_version }}` is
+injected from `src/dashscope_agenticx/_version.py` by `docs/hooks.py`.
+
+CI (`.github/workflows/docs.yml`) builds with `--strict` on pull requests
+and deploys to GitHub Pages on pushes to `main`.
+
+## Contribution rules
+
+1. Use Python 3.10–3.13.
+2. Create focused changes with tests.
+3. Run `pytest -q`, Black, isort, and flake8 before submitting.
+4. Keep Core dependencies small; new heavy dependencies belong in extras.
+5. Preserve the typed Event, Runtime, App Manifest, and Session contracts.
+6. Security-sensitive changes require negative tests for untrusted input.
+
+## Identity contract
+
+The canonical distribution and protocol/package identity is
+`dashscope-agenticx`, the import namespace is `dashscope_agenticx`, and the
+only official command is `agenticx` (no official short alias). Workspaces
+use `.agenticx/`, environment variables use `AGENTICX_*`, and the global app
+name is `AgenticX`. Do not introduce the unrelated bare `agenticx` PyPI
+distribution.
+
+## Release contract
+
+```bash
+python scripts/release_check.py
+```
+
+The release check validates package identity, version, imports, CLI, and
+bundled Apps. Coverage gates, cross-platform CI (Python 3.10–3.13;
+Ubuntu/macOS/Windows smoke checks), App validation, and supply-chain checks
+are separate release requirements — passing local unit tests alone does not
+publish or certify a release. Tag builds prepare wheel/source distributions
+and platform binaries with SHA-256 checksums in a draft GitHub Release for
+final review. See the repository `RELEASE.md` for packaging, checksums,
+SBOM, and publication gates.
\ No newline at end of file
diff --git a/docs/en/guides/agent-patterns.md b/docs/en/guides/agent-patterns.md
new file mode 100644
index 0000000..c58d031
--- /dev/null
+++ b/docs/en/guides/agent-patterns.md
@@ -0,0 +1,234 @@
+---
+description: "AgenticX agent patterns: subagents and delegation, lifecycle hooks, scheduled tasks, memory, rules, and prompt composition."
+---
+# Subagents, Hooks & Memory
+
+## Subagents and delegation
+
+### `subagent_invoke` (capability `local.subagent`)
+
+The model can spin up a second-level agent with an **isolated context** to
+run a subtask; only a summary comes back, so intermediate tool calls do not
+pollute the main conversation.
+
+| Parameter | Default | Description |
+|---|---|---|
+| `prompt` | required | The subtask, as a single user message |
+| `system_prompt` | empty | Override the subagent's role (reviewer / researcher / …) |
+| `max_turns` | 10 (cap 50) | Sub-loop turn limit to prevent runaway execution |
+
+The subagent **shares** the main agent's provider, executor, tool table,
+MemoryManager (plan progress, reflection hints), `/rule` rules, and
+capability notices — but **not** `session_path`: subagents are disposable
+and never write session history.
+
+Enabling `local.subagent` also registers three expert tools with fixed
+system prompts: `review_code` (bugs/security/performance/style),
+`write_tests` (pytest generation), `generate_docs` (API docs and examples).
+
+### `delegate` / `delegate_parallel` (capability `local.delegate`)
+
+Split complex tasks across multiple isolated subagents and aggregate:
+
+- `delegate` — sequential: one large prompt to a single subagent, full
+ result returned.
+- `delegate_parallel` — parallel: multiple `(name, prompt)` tasks at once;
+ results are joined as `name: result` for the main agent.
+
+| Parameter | Required | Description |
+|---|---|---|
+| `task` | yes | Task description |
+| `system_prompt` | no | Role override |
+| `tools` | no | Tool whitelist (e.g. `["read_file", "search_files"]`); empty inherits the main tool table |
+| `context_files` | no | File paths whose contents are prepended to the subtask |
+| `max_turns` | no | Default 10, cap 50 |
+| `timeout` | no | Per-subtask seconds, default 120 |
+| `model` | no | Subagent model; inherits by default |
+
+```toml
+# config.toml
+delegation = { max_concurrent = 5, default_timeout = 120 }
+```
+
+Subagents are **always forbidden from delegating further** (created with
+`allow_delegate=False`), preventing infinite cascades. The `allow_nested`
+config field is parsed and stored but currently has no effect.
+
+## Event hooks
+
+`.agenticx/hooks.toml` inserts custom behavior at lifecycle points:
+intercept dangerous tools, print warnings, run audit scripts, or ask for
+confirmation.
+
+| Event | Fires when |
+|---|---|
+| `before_tool_call` | Just before a tool executes |
+| `after_tool_call` | After a tool execution completes |
+| `on_error` | A tool raises or a subagent fails |
+| `on_message` | A user message is received |
+| `on_response` | An LLM response is received |
+
+Governance actions dispatch first; a `block` hit short-circuits all
+subsequent hooks:
+
+| Category | Action | Behavior |
+|---|---|---|
+| Governance | `block` | Block the operation, return a custom message to the agent |
+| Governance | `confirm` | Continue only after user confirmation |
+| Governance | `alert` | Red alert; escalates on tool failure |
+| Extension | `run` | Execute a shell command (`run = "..."` or argument array) |
+| Extension | `warn` | Yellow warning |
+| Extension | `log` | Write to the log, not the terminal |
+
+```toml
+# .agenticx/hooks.toml
+[[hooks.before_tool_call]]
+match = "write_file"
+condition = "*.py"
+action = "confirm"
+message = "About to write {filename}, confirm?"
+
+[[hooks.before_tool_call]]
+match = "run_command"
+content_pattern = "*rm -rf*"
+action = "block"
+message = "Dangerous command detected, blocked"
+
+[[hooks.after_tool_call]]
+match = "write_file"
+condition = "*.py"
+action = "run"
+run = ["python", "-m", "py_compile", "{path}"]
+on_fail = "warn"
+silent = true
+```
+
+Matching fields: `match` (tool-name glob, default `"*"`), `condition`
+(file-path glob extracted from arguments), `content_pattern` (content glob
+over arguments JSON or results). Other fields: `message` (template),
+`on_fail` (`warn` default / `alert` / `block`), `silent`.
+
+Template variables include `{tool_name}`, `{args}`, `{result}`, `{error}`,
+`{path}`, `{filename}`, `{filename_stem}`, `{content}`, `{exit_code}`,
+`{timestamp}`.
+
+!!! warning "Run-hook argument boundary"
+ Run hooks pass template values as **literal process arguments**, without
+ a shell. Command strings containing variables are parsed before
+ substitution; pipes and redirections are rejected. The executable cannot
+ be templated; templated hooks cannot invoke shell interpreters or
+ interpolate Python code/module names; Windows targets must not be
+ `.bat`/`.cmd`. Only constant command strings keep shell execution. This
+ boundary does not sandbox a script that evaluates its arguments as code.
+
+Skill packages can scope hooks to themselves via
+`.agenticx/skills//hooks.toml`, mounted on the same HookBus. Hooks are
+subject to trust and permission controls — see
+[Security](security-and-platform.md).
+
+## Scheduled tasks (`/cron`)
+
+Run Skills on a schedule; each run defaults to its own isolated subagent.
+Tasks persist across sessions in `~/.config/AgenticX/cron_jobs.json`.
+
+```text
+/cron add every 5m skill weather Hangzhou
+/cron add at 14:30 skill search AI morning briefing # one-shot
+/cron add cron "0 9 * * 1-5" skill search morning briefing
+/cron add every 1h skill weather Beijing skill search tech news
+/cron add every 10m skill search service alerts condition "curl -sf http://health"
+/cron add every 5m skill weather Hangzhou no-subagent # main conversation
+```
+
+Management: `/cron list|pause |resume |remove `.
+
+`at` tasks auto-disable after execution; each run has a 300-second timeout;
+cron tasks do not run while privacy mode is enabled.
+
+## System prompt and project instructions
+
+`.agenticx/system-prompt.md` (workspace) or
+`~/.config/AgenticX/system-prompt.md` (global) replaces the **base** prompt;
+workspace wins. The `PromptPipeline` then appends its sections — you do not
+need to redeclare tool usage, rules, or identity:
+
+```text
+[base prompt / system-prompt.md]
+[Project instructions]
+─── stable prefix: byte-identical for the whole session (prompt-cache friendly) ───
+[Skills templates] [Skill package rules] [Disabled-capability notice]
+[Long-lived operation rules] [Current plan] [Experience recall]
+[Tool-chain context] [Directive proposals] [Environment info]
+─── ephemeral suffix: recomputed every turn ───
+```
+
+Project instruction files are auto-discovered upward from the CWD,
+first match wins: `.agenticx/rules.jsonl` > `.agenticx/prompt.md` >
+`.agenticx/prompt` > `.agenticx/instructions.md` > `.cursorrules` >
+`.claude.md` > `CLAUDE.md`. YAML frontmatter is stripped; long files are
+truncated 60/40 head/tail at 8000 characters.
+
+## Rules vs profile
+
+Two complementary memory forms:
+
+| Dimension | `/profile` | `/rule` |
+|---|---|---|
+| Content | Identity, preferences, tech stack (facts) | Operation rules, process constraints |
+| Injection | Keyword recall — only relevant turns | Enabled rules — every turn |
+| Storage | `.agenticx/memory/.json` | `.agenticx/rules.jsonl` |
+| Example | "I'm a backend developer" | "Don't push after commit" |
+
+Rule of thumb: **`/profile` for "who I am"; `/rule` for "how things should
+be done".**
+
+```text
+/rule add "Do not push after each commit; wait until the user says push"
+/rule list | edit | enable | disable | remove | clear
+/profile list | search | add | remove | clear
+```
+
+More than 15 enabled rules triggers a trimming hint (tokens keep growing).
+
+**Directives auto-learning**: tool-call sequences are recorded to
+`.agenticx/memory/behavior_patterns.json`; after 5+ turns, adjacent tool
+pairs seen 3+ times become rule proposals (confidence =
+`min(count / 10, 1.0)`, at most 2 pending at a time). Review with
+`/directives proposals`, then `/directives accept ` or `reject `.
+Core does not learn directives or generate skills in the background by
+default beyond this proposal mechanism; experimental skill evolution
+requires the experimental pack and `AGENTICX_EXPERIMENTAL=1`.
+
+## Memory tiers and sessions
+
+| Tier | Content | Lifecycle |
+|---|---|---|
+| Working | Conversation messages; token-budget compression against the model context window (soft threshold → LLM summarization of old messages, hard threshold → truncation) | Within session |
+| Mid-term | Plan progress (TTL expiry), reflection hints, tool-chain patterns | Within session |
+| Long-term | Cross-session experience learning (`experiences.jsonl`, CJK-aware retrieval) | Across sessions |
+
+Sessions (topics) isolate working memory:
+`.agenticx/session//history.json`. Long-term memories (profile,
+skills, rules, experience) are shared across topics. Each topic can carry
+**scene memory** (`scene.md`) injected whenever you switch back:
+
+```text
+/session new|list|switch|rename|fork|remove
+/session scene Context: data platform, Python 3.11, pytest only
+/session scene set # replace
+/session scene clear
+```
+
+Experience memory records task outcomes and tool patterns; long tasks
+(6+ messages) are summarized automatically, `/summarize` triggers manually,
+and `/feedback good|bad` labels satisfaction. After 3+ consecutive tool
+failures, a reflection hint nudges the model to change strategy.
+
+Conversation history summaries live in `.agenticx/memory/history.json`
+(`/memory list|search|remove|clear`). Every LLM call and tool execution is
+traced to `.agenticx/traces/.jsonl` for debugging and evaluation
+(`/trace`, `/report`, `/stats`).
+
+Context management commands: `/compress` replaces history with an LLM
+summary; `/undo` reverts the last file write/delete via checkpoint
+snapshots.
\ No newline at end of file
diff --git a/docs/en/guides/sdk.md b/docs/en/guides/sdk.md
new file mode 100644
index 0000000..412657d
--- /dev/null
+++ b/docs/en/guides/sdk.md
@@ -0,0 +1,180 @@
+---
+description: "Embed AgenticX in Python applications: run_once, streaming, typed events, sessions, and the interactive loop."
+---
+# Embedding the SDK
+
+AgenticX exposes a small public SDK in `dashscope_agenticx.sdk`. Every entry
+point runs a **complete agent turn** — model invocation plus tool execution —
+not a bare chat completion.
+
+```python
+from dashscope_agenticx.sdk import (
+ load_config,
+ create_agent,
+ run_once,
+ run_once_sync,
+ run_stream,
+ run_events,
+ run_interactive,
+)
+```
+
+## One-shot turns
+
+`run_once_sync` is the easiest entry point for scripts and CI: it streams the
+full turn, executes any tool calls, and returns the final assistant text.
+
+```python
+from dashscope_agenticx.sdk import run_once_sync
+
+reply = run_once_sync("Inspect this project's structure without changing files")
+print(reply)
+```
+
+The async equivalent is `run_once`. Both enable one-shot guards and
+acceptance behavior internally; tool execution still respects your
+permission policy (default `confirm_mode = "all"` — see
+[Security](security-and-platform.md#permissions)).
+
+## Configuration overrides
+
+`load_config` reads the normal layered configuration (global → workspace →
+environment); explicit arguments only fill in missing values, they do not
+override what configuration or environment already set:
+
+```python
+from dashscope_agenticx.sdk import load_config, run_once_sync
+
+config = load_config(provider="tongyi", model="qwen-plus")
+reply = run_once_sync("Summarize this directory", config=config)
+```
+
+To force a provider/model regardless of configuration, set
+`AGENTICX_PROVIDER` / `AGENTICX_MODEL` in the environment. See
+[Configuration](../configuration.md).
+
+## Streaming text
+
+`run_stream` yields response text chunks as an async iterator. Tool display
+text is interleaved with model output, exactly as the terminal shows it:
+
+```python
+import asyncio
+from dashscope_agenticx.sdk import run_stream
+
+async def main():
+ async for chunk in run_stream("Write a haiku about the sea"):
+ print(chunk, end="", flush=True)
+
+asyncio.run(main())
+```
+
+If you stop consuming early, close the generator so the agent's runtime is
+released:
+
+```python
+import contextlib
+
+async with contextlib.aclosing(run_stream("Long task")) as chunks:
+ async for chunk in chunks:
+ if "STOP" in chunk:
+ break
+```
+
+The convenience wrappers (`run_once`, `run_stream`, `run_events`) create and
+close their own agent. When you manage an agent yourself, use `async with`
+or call `await agent.aclose()`.
+
+## Typed events
+
+`run_events` is the canonical execution API. It yields
+`AgentEventEnvelope` objects (alias `AgentEvent`) with a `type`, a `payload`
+dict, and correlation fields (`session_id`, `run_id`, `turn_id`, `sequence`,
+`event_id`, `timestamp`). Consume events instead of parsing terminal output:
+
+```python
+import asyncio
+from dashscope_agenticx.sdk import run_events, AgentEventType
+
+async def main():
+ async for event in run_events("Summarize the project"):
+ if event.type == AgentEventType.MESSAGE_DELTA:
+ print(event.payload["text"], end="", flush=True)
+ elif event.type == AgentEventType.TOOL_STARTED:
+ print(f"\n[tool] {event.payload.get('name', '')}")
+ elif event.type == AgentEventType.TURN_FINISHED:
+ print("\n[done]")
+
+asyncio.run(main())
+```
+
+Notes on the event contract:
+
+- `MESSAGE_DELTA` payloads carry `text`; tool display deltas additionally
+ carry `kind="tool"`, `tool_call_id`, and `name`. Filter on `kind` if you
+ want model text only.
+- `TURN_FINISHED` carries the final `output` text and the `tools` used.
+- Failures emit an `ERROR` event (`error_type`, `message`) **and then
+ re-raise** the exception — handle both if you need graceful degradation.
+ There is no unified exception tree; catch standard exceptions around the
+ iterator.
+- An `Agent` runs one event stream at a time; a second concurrent
+ `run_events` on the same agent raises `RuntimeError`.
+
+The full 15-event table is in the
+[Agent & Events reference](../reference/agent.md#event-types).
+
+## Sessions and custom agents
+
+`create_agent` gives you an explicit `Agent` with a system prompt override
+and optional persistent session:
+
+```python
+import asyncio
+from dashscope_agenticx.sdk import create_agent
+
+async def main():
+ async with create_agent(
+ system_prompt="You are a careful code reviewer.",
+ session_id="review-2026-11",
+ ) as agent:
+ async for chunk in agent.run_stream("Review src/app.py"):
+ print(chunk, end="")
+ # A second turn continues the same conversation history.
+ async for chunk in agent.run_stream("Now suggest fixes."):
+ print(chunk, end="")
+
+asyncio.run(main())
+```
+
+With `session_id`, history persists under
+`.agenticx/session//history.json` and survives process restarts. Without
+it, the conversation lives only in memory.
+
+## Embedding the interactive loop
+
+`run_interactive` launches the full AgenticX interactive experience (REPL or
+TUI) under your own product identity — this is how the DashScope SDK Expert
+is packaged:
+
+```python
+from dashscope_agenticx.sdk import run_interactive
+
+run_interactive(
+ system_prompt="You are an expert on myproduct.",
+ app_name="MyProduct Expert",
+ prompt_symbol="myproduct> ",
+ command="myproduct",
+)
+```
+
+It accepts provider/model defaults, `api_key`/`base_url`, an `sdk_index`
+for documentation lookup, and `tui=True/False` to force the interface.
+
+## Lower-level integration
+
+For full control, construct a Runtime directly with `RuntimeBuilder` and
+create agents from it; see the
+[Agent, Runtime & Events reference](../reference/agent.md). The localhost
+[Server](security-and-platform.md#local-http-api) exposes the same event
+stream over HTTP for non-Python clients.
\ No newline at end of file
diff --git a/docs/en/guides/security-and-platform.md b/docs/en/guides/security-and-platform.md
new file mode 100644
index 0000000..c253b49
--- /dev/null
+++ b/docs/en/guides/security-and-platform.md
@@ -0,0 +1,201 @@
+---
+description: "AgenticX security model: permissions, privacy, audit, OS sandbox, MCP integration, Bailian CLI, and the localhost Server."
+---
+# Security, Platform & MCP
+
+## Permissions
+
+The default is `confirm_mode = "all"`: writes and CONFIRM tools require
+approval. Explicit `deny` rules always win — including AUTO tools and
+`auto_approve` runs. Parallel delegates receive a read-only tool allowlist
+enforced during execution, not merely hidden from the model; children do
+not inherit the parent's cached approvals.
+
+Confirmation choices:
+
+- `y` — allow once.
+- `n` — deny once; the agent receives "operation cancelled" and moves on.
+- `a` — trust this tool name for **the current turn only** (one
+ `run_stream` call); cleared automatically at turn end. Inspect with
+ `/trust`, clear with `/trust clear`.
+- `s` — raises `UserAbortedTurn`; the loop ends and control returns to the
+ prompt.
+
+DANGEROUS tools (`delete_file`, `delete_directory`) accept only `y`/`n` —
+never cached.
+
+### Always-active protection layers
+
+Independent of permission level:
+
+- **Sensitive paths**: reads/writes of `.ssh`, `.aws`, `.gnupg`, `.env`,
+ `.npmrc`, `shadow`, etc. are always rejected.
+- **Hard-blocked commands**: `rm -rf /`, `mkfs`, `dd if=`, `> /dev/sd`,
+ `chmod -R 777 /` and similar are rejected outright, without confirmation.
+- **Read-only classification**: `run_command` auto-allows known read-only
+ commands (`grep`, `ls`, `find`, `cat`, `git status`, `git log`,
+ `git diff`, `pip list`, `docker ps`, …). Any write signal (`rm`, `mv`,
+ `cp`, `chmod`, `sudo`, `pip install`, `make`, redirection `>`, command
+ substitution `$(…)`) falls back to the confirmation flow.
+
+### Policy engine
+
+Preset per-tool / per-command-prefix rules in `permissions.toml` (workspace
+`./.agenticx/` overrides global `~/.config/AgenticX/` on the same key).
+Policy takes precedence over interactive confirmation; command rules match
+by longest prefix:
+
+```toml
+# .agenticx/permissions.toml
+[tools]
+delete_file = "deny"
+
+[commands]
+"git status" = "allow"
+"git push" = "deny" # longest prefix wins over git = allow
+```
+
+App install/update previews new permissions before copying files. Expert
+templates cannot install `skills/**/tools.py`, shell tools, or executable
+run hooks — even with `--force`; use trusted App Bundles for executable
+extensions. Permission metadata and checksums are **not** OS/filesystem/
+network isolation or a publisher signature.
+
+## OS sandbox
+
+`sandbox = true` in config runs shell commands inside an OS sandbox when a
+backend is available:
+
+| Platform | Backend | Notes |
+|---|---|---|
+| macOS | Seatbelt (`sandbox-exec`, built in) | Profile confines writes to the workspace |
+| Linux | bubblewrap (`bwrap`, if installed) | Read-only root with workspace bind |
+| Windows | — | No backend; commands run unsandboxed |
+
+Sandbox support is defense in depth, not a hardened isolation contract.
+Availability and limitations depend on the backend; review the reported
+execution boundary (`SANDBOX_STATUS` events, `/info`) before automation.
+
+## Privacy mode
+
+```text
+/privacy on | off | status
+```
+
+| Effect | Description |
+|---|---|
+| Cloud capabilities disabled | `bailian.*` treated as not enabled (`/mcp` intercepted); local memory/storage unaffected |
+| Scheduled tasks paused | cron runs skipped, marked "skipped due to privacy mode" |
+| Audit sanitization | Tool arguments and user input truncated to 20 characters |
+
+!!! note
+ Privacy mode does **not** block LLM API calls — conversation content is
+ still sent to the model provider. For fully offline use, switch to a
+ local provider such as `ollama`.
+
+## Audit log
+
+Key operations append as JSONL to `./.agenticx/audit.log` (per workspace):
+
+```jsonc
+{
+ "timestamp": "2026-11-19T10:00:00Z",
+ "source": "agent", // user / agent / scheduler / system
+ "action": "tool_call", // input / tool_call / permission / cron / mcp
+ "subject": "run_command",
+ "decision": "approved", // approved / denied / executed / skipped / auto
+ "reason": "",
+ "details": { "args": { "command": "git status" } }
+}
+```
+
+```text
+/audit recent [n] # latest records (default 20)
+/audit query tool_call # filter by action
+/audit clear
+```
+
+Under privacy mode, parameter values (`content`, `command`, `query`,
+`text`, `prompt`, `url`, `path`, `file`) are truncated to 20 characters
+with `…(redacted)`; tool names and decisions are always preserved.
+
+## MCP integration
+
+AgenticX is both an MCP **client** and **server**.
+
+### Client (`/mcp`, capability `bailian.mcp`)
+
+Connects over **SSE transport**, registering tools as
+`mcp__`. Works with the Bailian MCP marketplace and any
+SSE-compatible third-party/local service:
+
+```text
+/capability enable bailian.mcp # requires DASHSCOPE_API_KEY for Bailian
+/mcp list # marketplace services
+/mcp add time # Bailian default endpoint
+/mcp add my-server http://localhost:3000/sse # custom SSE URL
+/mcp # connected services + tools
+/mcp remove my-server
+```
+
+Connections persist to `[[mcp_servers]]` in workspace `config.toml` and
+reconnect on startup. Third-party services that need no Bailian key can
+leave `tongyi_api_key` empty; service-side auth is handled at the SSE
+endpoint (e.g. token in URL).
+
+!!! note "Transport limitation"
+ The MCP client supports SSE over HTTP only — not stdio. Wrap a local
+ stdio MCP server as a tool via `[[shell_tools]]` /
+ `[[capabilities.tools]]` instead.
+
+### Server (`agenticx mcp-server`)
+
+Exposes registered tools to other MCP-compatible agents over stdio
+(JSON-RPC), protocol version `2024-11-05`, methods `tools/list` and
+`tools/call`.
+
+!!! warning
+ The MCP server executes tools in `auto_approve` mode (no interactive
+ confirmation). Only expose it to trusted clients.
+
+## Bailian CLI
+
+With the `bailian.cli` capability enabled, `bl` on PATH and authenticated
+(`bl auth login`), AgenticX registers the full Bailian command set as native
+function-call tools (`bailian_text_chat`, `bailian_image_generate`, …). Schemas come from
+`bl config export-schema`, cached 24h in
+`~/.config/AgenticX/bl-schemas.json`; camelCase parameters convert to
+`--kebab-case` flags automatically. Permissions tier by verb: read verbs
+Auto, quota/file-producing verbs Confirm. AgenticX passes the configured
+DashScope key through as `--api-key`, so authentication is configured once.
+`bailian.cli` and `bailian.mcp` can coexist without tool-name collisions.
+
+## Local HTTP API
+
+`agenticx serve` starts a token-authenticated localhost Client API for
+Runs, Sessions, Artifacts, and Traces:
+
+```bash
+agenticx serve --token # default 127.0.0.1:8765
+# token omitted → generated and printed at startup
+```
+
+| Route | Method | Purpose |
+|---|---|---|
+| `/health` | GET | Liveness |
+| `/v1/sessions`, `/v1/sessions/` | GET | Session list / state |
+| `/v1/artifacts?session_id=…` | GET | Artifacts |
+| `/v1/traces` | GET | Trace file names |
+| `/v1/runs` | POST | Run a turn (`input`, optional `session_id`, `system_prompt`); returns the typed event list |
+| `/v1/permissions*` | POST | Always **403** — permission decisions are local-runtime only |
+
+Requests need `Authorization: Bearer ` (constant-time comparison).
+The server binds only to `127.0.0.1` / `localhost` / `::1`; other hosts are
+rejected. Runs force `auto_approve = False` and `confirm_mode = "all"`, and
+any action requiring approval is **denied** even when local CLI config
+enables automatic execution. This is not an Internet-facing deployment
+contract.
+
+For Python clients, embed the [SDK](sdk.md) directly instead; for
+non-Python clients, consume the same `AgentEventEnvelope` payloads from
+`/v1/runs`.
\ No newline at end of file
diff --git a/docs/en/guides/tools-and-skills.md b/docs/en/guides/tools-and-skills.md
new file mode 100644
index 0000000..41436a2
--- /dev/null
+++ b/docs/en/guides/tools-and-skills.md
@@ -0,0 +1,326 @@
+---
+description: "AgenticX tools, permission tiers, custom extensions, the Skills system, and Expert templates."
+---
+# Tools, Skills & Experts
+
+## Built-in tools and permission tiers
+
+Every tool has a permission tier that decides how it is confirmed:
+
+| Tier | Behavior |
+|---|---|
+| **Auto** | No prompt; the model calls it directly |
+| **Confirm** | Prompts `[y]es / [n]o / [a]lways (this conversation) / [s]top (abort turn)` |
+| **Dangerous** | Only `y` / `n` — destructive operations are asked every time; the "always" cache cannot bypass them |
+
+Explicit policy denies in `permissions.toml` apply even to AUTO tools and
+`auto_approve` runs. See [Permissions](security-and-platform.md#permissions).
+
+### Filesystem
+
+| Tool | Permission | Description |
+|---|---|---|
+| `read_file` | Auto | Read file contents (line offset/limit) |
+| `write_file` | Confirm | Write a file, returns a unified diff |
+| `list_directory` | Auto | List directory contents with types and sizes |
+| `create_directory` | Confirm | Create directories including nested parents |
+| `delete_file` | Dangerous | Delete a file (irreversible) |
+| `delete_directory` | Dangerous | Delete a directory tree (irreversible) |
+| `search_files` | Auto | Search files by glob pattern |
+| `move_file` | Confirm | Move / rename a file or directory |
+
+### Shell
+
+`run_command` (Confirm) executes shell commands. Dangerous-mode commands are
+intercepted and read-only commands are classified automatically. A `timeout`
+argument (seconds, default 600, `AGENTICX_COMMAND_TIMEOUT`) caps the run; on
+expiry the whole process group is killed, so a pipeline does not outlive the
+timeout.
+
+### Network (optional `web` / `browser` extras)
+
+| Tool | Permission | Description |
+|---|---|---|
+| `web_search` | Auto | DuckDuckGo search: titles, URLs, snippets |
+| `scrape_web` | Auto | Page plain text via Playwright headless browser (renders JS SPAs) |
+| `scrape_web_html` | Auto | Rendered HTML source |
+| `scrape_web_screenshot` | Auto | Screenshot saved as an image file |
+
+Browser tools need a separate Playwright runtime setup after installing the
+extra. Camera tools (`camera_capture`, `camera_record`, both Confirm) need
+the `camera`/`vision` media extras.
+
+### Session & configuration (always available)
+
+`switch_model`, `switch_provider`, `list_models`, `capability_list` (Auto);
+`capability_enable`, `capability_disable`, `mcp_connect`, `mcp_disconnect`
+(Confirm); `mcp_list_services`, `create_plan`, `complete_step`,
+`get_plan_status` (Auto).
+
+### Subagents (after enabling `local.subagent` / `local.delegate`)
+
+`subagent_invoke`, `review_code`, `write_tests`, `generate_docs`, `delegate`,
+`delegate_parallel` — all Auto. See
+[Subagents, Hooks & Memory](agent-patterns.md#subagents-and-delegation).
+
+### Platform tools (after enabling `bailian.cli`)
+
+The full Bailian CLI command set is registered as `bailian_`
+tools (e.g. `bailian_text_chat`, `bailian_image_generate`). Read verbs
+(list/get/status/search) are Auto; write verbs (generate/upload/delete) are
+Confirm. Schemas come from `bl config export-schema` and are cached for 24h.
+See [Platform integration](security-and-platform.md#bailian-cli).
+
+## Capabilities
+
+Optional tool groups are gated by capabilities:
+
+```text
+agenticx> /capability list
+agenticx> /capability enable bailian.cli # takes effect after restart
+agenticx> /capability disable local.subagent
+agenticx> /capability reload
+```
+
+Commands for disabled capabilities are intercepted with an enable hint
+instead of failing on credentials. Installing an extra never grants an App
+permissions by itself.
+
+## Custom tools
+
+### Layer 1 — configuration as program (no code)
+
+`custom-extensions.toml` (workspace `./.agenticx/` overrides global
+`~/.config/AgenticX/`; files are chmod 600) registers providers, HTTP tool
+groups, and shell tools at startup. `/dev reload` hot-reloads it.
+
+HTTP tool group:
+
+```toml
+[[capabilities]]
+key = "moonshot.web"
+display = "Moonshot web search"
+auth = "bearer:$MOONSHOT_API_KEY"
+
+[[capabilities.tools]]
+name = "web_search"
+description = "Web search for real-time information"
+endpoint = "https://api.moonshot.cn/v1/tools/web_search"
+http_method = "POST"
+permission = "auto" # auto / confirm / dangerous
+params = [
+ {name="query", type="string", required=true, description="Search keywords"},
+ {name="count", type="integer", default=10, description="Number of results"},
+]
+body_template = '{"query": {{query}}, "count": {{count}}}'
+result_jsonpath = "data.results" # optional dot-path extraction
+```
+
+Auth formats: `bearer:$ENV`, `apikey-header:HeaderName:$ENV`, `none`.
+Body templates use Mustache `{{var}}` placeholders (values are JSON-encoded
+before substitution).
+
+Shell tool — wrap a command as an LLM-callable tool:
+
+```toml
+[[shell_tools]]
+name = "check_port"
+description = "Check whether a TCP port is open"
+command_template = "nc -z -w 3 {{host}} {{port}}"
+params = [
+ {name="host", type="string", required=true},
+ {name="port", type="integer", required=true},
+]
+permission = "auto"
+```
+
+Parameterized `{{name}}` values are passed as literal process arguments,
+even when the placeholder is quoted. Parameterized pipelines, redirections,
+shell interpreters, and executable Python code/module names are rejected;
+for complex workflows call a trusted executable script with literal
+arguments. Constant commands without parameters keep explicit shell
+behavior.
+
+Provider declarations (`[[providers]]`) and API-key security rules are
+covered in [Configuration](../configuration.md#custom-providers).
+
+### Layer 2 — real Python tools
+
+Register a `ToolDefinition` with the runtime registry, or use the `@tool`
+decorator (the parameter schema is derived from type hints):
+
+```python
+from dashscope_agenticx.tools.registry import (
+ PermissionLevel,
+ ToolDefinition,
+ tool,
+)
+
+@tool("check_complexity", "Check cyclomatic complexity of a file",
+ permission=PermissionLevel.AUTO)
+async def check_complexity(path: str) -> str:
+ ...
+```
+
+Inside a Skill package, expose a `register(registry)` function in `tools.py`;
+tool names are automatically prefixed with the package name
+(`my-review_check_complexity`):
+
+```python
+from dashscope_agenticx.tools.registry import PermissionLevel, ToolDefinition
+
+async def check_complexity(path: str) -> str:
+ ...
+
+def register(registry):
+ registry.register(ToolDefinition(
+ name="check_complexity",
+ description="Check the cyclomatic complexity of a file",
+ func=check_complexity,
+ permission=PermissionLevel.AUTO,
+ parameters={
+ "type": "object",
+ "properties": {"path": {"type": "string"}},
+ "required": ["path"],
+ },
+ ))
+```
+
+The `/dev` command family scaffolds all of this interactively:
+`/dev provider|capability|skill|tool add|list|rm`, `/dev model add`,
+`/dev debug tools|schema|call|prompt`, `/dev test provider `.
+The legacy `.agenticx/plugins/` auto-loading mechanism is removed — use
+Layer-1 TOML, hooks, or Layer-2 modules instead.
+
+## Skills
+
+Skills are preset prompt templates invoked with `/skill`. Two forms:
+single-file `.md` and directory packages. At startup
+`~/.config/AgenticX/skills/` and `.agenticx/skills/` are scanned; a
+same-named workspace skill overrides the global one.
+
+### Single-file skill
+
+YAML frontmatter defines metadata; the body is the prompt template with
+`{arg}` placeholder substitution:
+
+```markdown
+---
+name: review
+description: Code review with improvement suggestions
+arguments: [file]
+---
+Please perform a code review of the following file, focusing on:
+1. Potential bugs
+2. Performance issues
+3. Readability
+
+File: {file}
+```
+
+Invoke with `/skill review src/main.py`. Single-file skills are injected
+into the system prompt as a compact catalog (args, description, MCP
+dependency status).
+
+### Directory-package skill
+
+For custom Python tools or dedicated hooks:
+
+```text
+.agenticx/skills/my-review/
+├── skill.toml # metadata, activation rules
+├── prompt.md # prompt template
+├── tools.py # optional: custom tools (prefixed my-review_)
+└── hooks.toml # optional: hooks scoped to this skill
+```
+
+```toml
+# skill.toml
+name = "my-review"
+version = "1.0.0"
+description = "Custom code review with a complexity check tool"
+author = "your-name"
+always_active = false
+triggers = ["*review*", "*audit*"]
+```
+
+- `always_active = true`: `prompt.md` is injected every turn.
+- `triggers`: glob patterns; the skill activates when the user message
+ matches any pattern.
+
+### Lifecycle
+
+```text
+/skill list # single files + packages
+/skill reload # rescan directories
+/skill enable|disable # force state (ignore triggers)
+/skill install ./my-review # local path / git+URL / tar.gz URL / registry name[@version]
+/skill link ./my-review # dev symlink; /skill reload picks up edits
+/skill update |--all
+/skill uninstall
+/skill search review # installed + registry
+/skill publish ./my-review # validate + package tar.gz into .dist/
+```
+
+Installation records live in `.agenticx/skills/.agenticx-skills.json`.
+URL packages undergo tar path-traversal validation (including link targets)
+and a 50 MB size limit.
+
+A registry is a static TOML/JSON/YAML index — no server dependency:
+
+```toml
+# index.toml
+[[skills]]
+name = "code-review"
+version = "1.2.0"
+description = "Code review (security+style+performance)"
+source = "git+https://github.com/agenticx/skills/code-review.git"
+tags = ["python", "review"]
+```
+
+Point `skill_registry` in `.agenticx/config.toml` at the index URL or a
+local file. Without a registry, `/skill install ` requires a local
+path or git URL.
+
+## Experts
+
+**Configuration is the Agent.** An Expert is a ready-to-use `.agenticx/`
+profile — persona, providers, skills, knowledge index — with no bootstrap
+code. Downloading one is the recommended starting point for a new Agent:
+
+```bash
+agenticx expert # list templates
+agenticx expert download basic-chat # merge into ./.agenticx/
+agenticx # already the Expert's Agent
+```
+
+- The Expert's `.agenticx/` tree is merged into the workspace; root-level
+ files (README etc.) are collected into `.agenticx/` too.
+- Same-named files are backed up to `.agenticx/backup/` (single rolling
+ backup); `/expert restore` undoes the merge — restoring overwritten files
+ and removing added ones.
+- Customize by plain-text editing: `system-prompt.md` (persona),
+ `skills/*.md` (task templates), `references/*.md` (always-on knowledge,
+ injected at startup), `custom-extensions.toml` (providers/tools).
+
+Profiles download from `apps//` in
+[dashscope/dashscope-agenticx-experts](https://github.com/dashscope/dashscope-agenticx-experts)
+(branch `main` by default). Only the 1.0 App Catalog layout is supported.
+Override the source with `expert_repo` / `expert_branch` in global config
+or `--repo`.
+
+Bundled examples: `basic-chat` (minimal general assistant with web search),
+`dashscope-sdk-expert` (SDK Q&A with an auto-generated knowledge index and
+`/skill update-sdk` refresh), and `bailian-expert`.
+
+### Experts vs App Bundles
+
+Expert downloads contain role/configuration data — not executable Python,
+shell tools, or run hooks — and are **not** registered as Apps. A production
+App Bundle adds a versioned `app.toml` manifest, Runtime compatibility
+range, permission diffs, and checksum verification, managed with
+`agenticx app list|install|info|verify|update`. `app install` previews new
+permissions before writing files and registers the bundle under
+`.agenticx/apps/` without activating its profile. A checksum proves content
+identity, not publisher authenticity; a local trust flag is not a verified
+digital signature.
\ No newline at end of file
diff --git a/docs/en/index.md b/docs/en/index.md
new file mode 100644
index 0000000..241edd4
--- /dev/null
+++ b/docs/en/index.md
@@ -0,0 +1,143 @@
+---
+description: "DashScope AgenticX — Python agent runtime: terminal CLI, embeddable SDK, tools, skills, and governed execution."
+---
+# DashScope AgenticX
+
+
+
+**Enterprise AI experts, built to act.** AgenticX is a Python agent
+runtime for building and running domain experts. It connects models,
+tools, skills, permissions, and persistent sessions through one runtime,
+with a terminal interface and APIs for embedded applications.
+
+
+[Quickstart](quickstart.md){ .md-button .md-button--primary }
+[Embed the SDK](guides/sdk.md){ .md-button }
+
+
+Use it directly as a local assistant, embed it in a Python application,
+or package a domain expert as a versioned App Bundle. DashScope SDK
+Expert and Bailian Expert are bundled expert templates illustrating this
+application layer.
+
+## Features
+
+
+
+- :material-robot:{ .lg .middle } **One runtime**
+
+ ---
+
+ Instance-owned tool, skill, hook, and session state; shared
+ construction through `RuntimeBuilder`.
+
+- :material-console:{ .lg .middle } **Terminal & TUI**
+
+ ---
+
+ A full interactive CLI with 40+ slash commands, plus an optional
+ Textual TUI with rich Markdown output.
+
+- :material-code-braces:{ .lg .middle } **Embeddable SDK**
+
+ ---
+
+ `run_once`, `run_stream`, and typed `run_events` for scripts, CI,
+ IDE plugins, and applications.
+
+- :material-toolbox:{ .lg .middle } **Tools & skills**
+
+ ---
+
+ Filesystem, shell, web, browser, camera, MCP services, markdown
+ skills, and declarative TOML extensions — no code required.
+
+- :material-shield-check:{ .lg .middle } **Governed execution**
+
+ ---
+
+ Permission tiers, policy files, OS sandbox backends, audit log,
+ privacy mode, and event hooks.
+
+- :material-package-variant:{ .lg .middle } **Apps & experts**
+
+ ---
+
+ Versioned App manifests with checksum verification and permission
+ diffs; one-command expert workspace initialization.
+
+
+
+## Requirements
+
+- Python 3.10+ (Pillow-backed `vision`/`media` extras need 3.11+).
+- A model API key for your provider — for the default Tongyi/DashScope
+ provider:
+
+```shell
+export DASHSCOPE_API_KEY=""
+```
+
+## Installation
+
+```shell
+python -m pip install "dashscope-agenticx[tui]"
+agenticx --version
+```
+
+For a minimal, non-TUI install use `pip install dashscope-agenticx` and
+start with `agenticx --cli`. Optional extras (provider SDKs, web,
+browser, media) are listed in [Quickstart](quickstart.md#optional-extras).
+
+## Examples
+
+### Run it in the terminal
+
+```shell
+agenticx # interactive session
+agenticx -c "Summarize this project" # one-shot, then exit
+```
+
+### Run it from Python
+
+```python
+from dashscope_agenticx.sdk import run_once_sync
+
+reply = run_once_sync("Inspect this project's structure without changing files")
+print(reply)
+```
+
+### Consume typed events
+
+```python
+import asyncio
+
+from dashscope_agenticx.sdk import run_events
+
+
+async def main():
+ async for event in run_events("Summarize the project"):
+ print(event.type.value, event.payload)
+
+
+asyncio.run(main())
+```
+
+One-shot runs execute tools, not just generate text — start in a
+suitable workspace and choose permissions appropriate to the task.
+
+## Where to go next
+
+- [Quickstart](quickstart.md) — install, first run, first SDK call.
+- [Configuration](configuration.md) — config layers, providers, keys.
+- [CLI & Commands](cli.md) — every slash command and CLI option.
+- [Reference](reference/sdk.md) — the full API surface.
+
+AgenticX is not a hosted service, a hardened OS sandbox, or a complete
+workflow platform. Voice, camera, browser, web search, scheduler, and
+experimental features are optional, not prerequisites for the core
+runtime.
\ No newline at end of file
diff --git a/docs/en/migration.md b/docs/en/migration.md
new file mode 100644
index 0000000..13b15a8
--- /dev/null
+++ b/docs/en/migration.md
@@ -0,0 +1,75 @@
+---
+description: "Migrate from legacy AgenticCLI to DashScope AgenticX 1.0: naming, directories, credentials, and compatibility."
+---
+# Migrating to AgenticX 1.0
+
+This guide describes migration from legacy AgenticCLI versions to
+DashScope AgenticX `{{ agenticx_version }}`.
+
+## Current identities
+
+| Aspect | AgenticX 1.0 |
+|---|---|
+| Product | AgenticX / DashScope AgenticX |
+| Distribution | `pip install dashscope-agenticx` (extras as needed, e.g. `"dashscope-agenticx[all]"`) |
+| Import | `dashscope_agenticx`, `dashscope_agenticx.sdk` |
+| Command | `agenticx` — there is no official short alias |
+| Apps | `agenticx app install`; `/expert` manages role templates |
+| Workspace | `.agenticx/` |
+| Environment | `AGENTICX_*` variables |
+| Global config | Platform-standard directory for app name `AgenticX` (via `platformdirs`); `AGENTICX_HOME` overrides |
+| Events | Consume `AgentEventEnvelope` via `run_events()` |
+
+!!! warning "Do not install the bare `agenticx` PyPI package"
+ The unrelated bare `agenticx` distribution is a different project.
+ The official distribution is `dashscope-agenticx`.
+
+Rename legacy `AGENTICCLI_*` and `ACLI_*` environment variables to their
+`AGENTICX_*` equivalents. Optional packs (TUI, provider SDKs, web, browser,
+media) are installed explicitly — see [Quickstart](quickstart.md#optional-extras).
+
+Expert downloads default to
+`https://github.com/dashscope/dashscope-agenticx-experts.git` on branch `main`.
+An explicit `expert_repo` setting or `--repo` flag selects another source.
+The catalog uses only `apps//`; legacy top-level Expert directories are
+not supported.
+
+## One-way directory migration
+
+Workspace migration prefers `.agenticcli/` and otherwise falls back to
+`.acli/`. Global migration prefers the legacy platform-standard `AgenticCLI`
+directory and otherwise falls back to `~/.acli/`. The selected source is
+migrated once to `.agenticx/` (workspace) or the platform-standard `AgenticX`
+directory (global).
+
+- An atomic rename is used when source and destination support it.
+- Otherwise a verified copy is made. The source is preserved after copying;
+ remove it manually once you have verified the result.
+- If the destination already exists, both directories are left untouched:
+ no merge, no overwrite, no migration into it.
+- Writes go only to the new location. There is no dual write to legacy
+ directories; migration does not run repeatedly or copy changes back.
+
+## Credentials
+
+New credentials are written as OS-keyring references under the
+`dashscope-agenticx` service. Reads retain fallback to the legacy `agenticcli`
+keyring service so existing references continue to resolve; legacy `ENC:`
+values are also read for migration.
+
+New saves do not dual-write secrets to legacy services and do not persist
+reversible API-key ciphertext in TOML. Do not treat legacy `ENC:` values as
+secure encryption — re-save keys to move them into the OS keyring.
+
+## What does not migrate automatically
+
+- Import statements (`agenticcli` → `dashscope_agenticx`) and environment
+ variable names need an explicit update in your code and shell profiles.
+- Existing destination directories are never merged; resolve conflicts
+ manually.
+- Expert/App installation contracts changed: role templates live under
+ `apps//` in the catalog; versioned App Bundles are managed with
+ `agenticx app …`, not `/expert`.
+
+See [Security & Compatibility](guides/security-and-platform.md) for the
+trust and permission model that governs migrated configuration.
\ No newline at end of file
diff --git a/docs/en/quickstart.md b/docs/en/quickstart.md
new file mode 100644
index 0000000..d9d6acf
--- /dev/null
+++ b/docs/en/quickstart.md
@@ -0,0 +1,117 @@
+---
+description: "Install AgenticX, configure an API key, run the first terminal session and the first Python SDK call."
+---
+# Quickstart
+
+## Install
+
+Python **3.10+** is required.
+
+=== "Package"
+
+ ```shell
+ python -m pip install "dashscope-agenticx[tui]"
+ agenticx --version
+ ```
+
+ For a minimal, non-TUI installation:
+
+ ```shell
+ python -m pip install dashscope-agenticx
+ agenticx --cli
+ ```
+
+=== "From source"
+
+ ```shell
+ python -m venv .venv
+ # macOS / Linux
+ source .venv/bin/activate
+ # Windows PowerShell: .venv\Scripts\Activate.ps1
+ python -m pip install -e ".[tui]"
+ agenticx --version
+ ```
+
+The distribution is **`dashscope-agenticx`**, the import namespace is
+**`dashscope_agenticx`**, and the only official command is **`agenticx`**.
+The bare `agenticx` PyPI distribution is a different project.
+
+### Optional extras
+
+| Extra | Purpose |
+|---|---|
+| `tui` | Textual interface with fixed input panel and rich output |
+| `provider-openai`, `provider-anthropic` | Provider-specific SDK routes |
+| `web`, `browser` | Search and browser tools (browser runtime setup is separate) |
+| `voice`, `camera`, `vision` (or `media`) | Audio, camera, and image dependencies |
+| `dev`, `all` | Test/build tooling and all optional features |
+
+```shell
+python -m pip install "dashscope-agenticx[web,browser]"
+```
+
+Installing dependencies does not grant an App permissions.
+
+## Set an API key
+
+For the default Tongyi/DashScope provider:
+
+```shell
+export DASHSCOPE_API_KEY=""
+# Windows PowerShell: $env:DASHSCOPE_API_KEY=""
+```
+
+Other providers use `ANTHROPIC_API_KEY` / `OPENAI_API_KEY`, or the
+per-provider key slots managed by `/provider` (stored in the OS
+keyring). See [Configuration](configuration.md#global-config-api-keys). Do not paste
+real keys into tracked configuration files.
+
+## First terminal run
+
+```shell
+agenticx
+```
+
+A new workspace without `.agenticx/config.toml` starts the `/setup`
+wizard: username, configuration mode (Default — Alibaba/Bailian, or
+Custom), provider/model, API key, capabilities, and an optional expert
+template. Existing configured workspaces skip straight to the prompt.
+
+```text
+agenticx> Summarize this project's structure before making any edits
+agenticx> /help
+agenticx> /provider
+agenticx> /session
+```
+
+Other entry modes:
+
+```shell
+agenticx --cli # inline REPL with native scrollback
+agenticx --tui # Textual interface (tui extra)
+agenticx -c "List the files here and summarize the project"
+agenticx --dry-run # preview loaded configuration
+```
+
+One-shot runs can execute tools. Start in a suitable workspace and keep
+the default `confirm_mode = "all"` until you trust the task.
+
+## First SDK call
+
+```python
+from dashscope_agenticx.sdk import run_once_sync
+
+reply = run_once_sync("Summarize the key points of README.md")
+print(reply)
+```
+
+`run_once_sync` runs a complete turn — including tool calls — and
+returns the final assistant text. For streaming and typed events see
+[Embedding the SDK](guides/sdk.md).
+
+## Next steps
+
+- [Configuration](configuration.md) — config files, providers, keys.
+- [CLI & Commands](cli.md) — the full command surface.
+- [Tools, Skills & Experts](guides/tools-and-skills.md) — extend the agent.
+- [Security, Platform & MCP](guides/security-and-platform.md) — permissions and platform capabilities.
\ No newline at end of file
diff --git a/docs/en/reference/agent.md b/docs/en/reference/agent.md
new file mode 100644
index 0000000..30396db
--- /dev/null
+++ b/docs/en/reference/agent.md
@@ -0,0 +1,86 @@
+---
+description: "Agent, Runtime, and typed event stream API reference for AgenticX."
+---
+# Agent, Runtime & Events
+
+An `Agent` runs one conversation turn at a time and emits typed events.
+The `Runtime` wires configuration, providers, tools, and platforms
+together; `RuntimeBuilder` is the composition entry point used by both
+the CLI and the [SDK](sdk.md).
+
+## Lifecycle
+
+`Agent` supports `async with` and explicit `await agent.aclose()`. The
+SDK helpers (`run_once`, `run_stream`, `run_events`) close the agent for
+you; when you drive `Agent` directly, close it yourself:
+
+```python
+import asyncio
+
+from dashscope_agenticx.sdk import create_agent
+
+
+async def main():
+ async with create_agent(session_id="demo") as agent:
+ async for chunk in agent.run_stream("Hello!"):
+ print(chunk, end="", flush=True)
+
+
+asyncio.run(main())
+```
+
+Both `run_events()` and `run_stream()` are single-pass async generators.
+To stop early, close the generator (`contextlib.aclosing`) — see
+[Embedding the SDK](../guides/sdk.md).
+
+## Event types
+
+Every event is an `AgentEventEnvelope` with a type from `AgentEventType`:
+
+| Type | Meaning |
+|---|---|
+| `run.started` | A turn began |
+| `message.delta` | Incremental assistant text |
+| `reasoning.delta` | Incremental reasoning/thinking text |
+| `plan.updated` | The agent's plan changed |
+| `tool.started` / `tool.finished` | Tool execution boundaries |
+| `permission.requested` / `permission.resolved` | Approval flow |
+| `usage.updated` | Token usage accounting |
+| `artifact.created` | A deliverable file was produced |
+| `compression.completed` | Context compression ran |
+| `provider.switched` | Fallback/routing changed provider |
+| `sandbox.status` | Sandbox backend state |
+| `turn.finished` | The turn completed |
+| `error` | A recoverable or fatal error surfaced |
+
+Errors are delivered as `error` events inside the stream — AgenticX has
+no unified exception hierarchy for model/tool failures. See
+[Eval](eval.md#exceptions) for the few control-flow exceptions.
+
+## Agent
+
+::: dashscope_agenticx.agent.Agent
+
+## Runtime
+
+::: dashscope_agenticx.runtime.Runtime
+
+::: dashscope_agenticx.runtime.RuntimeBuilder
+
+::: dashscope_agenticx.runtime.RuntimeContext
+
+::: dashscope_agenticx.runtime.import_builtin_tools
+
+::: dashscope_agenticx.runtime.create_runtime_memory
+
+## Events
+
+::: dashscope_agenticx.events.AgentEventType
+
+::: dashscope_agenticx.events.AgentEventEnvelope
+
+::: dashscope_agenticx.events.AgentEvent
+
+::: dashscope_agenticx.events.ToolDisplayText
+
+::: dashscope_agenticx.events.iter_message_deltas
\ No newline at end of file
diff --git a/docs/en/reference/eval.md b/docs/en/reference/eval.md
new file mode 100644
index 0000000..823c105
--- /dev/null
+++ b/docs/en/reference/eval.md
@@ -0,0 +1,37 @@
+---
+description: "Evaluation harness and control-flow exceptions API reference."
+---
+# Eval
+
+The eval harness runs scripted cases against the agent and compares
+providers. Cases load from YAML/JSON suites; results carry per-case
+scores and transcripts.
+
+## Harness
+
+::: dashscope_agenticx.eval.EvalCase
+
+::: dashscope_agenticx.eval.EvalResult
+
+::: dashscope_agenticx.eval.EvalRunner
+
+::: dashscope_agenticx.eval.ProviderComparator
+
+::: dashscope_agenticx.eval.load_eval_suite
+
+## Exceptions
+
+AgenticX surfaces model and tool failures as `error` events in the
+[agent event stream](agent.md#event-types), not as a unified exception
+tree. The few exceptions that do exist are control-flow signals or
+platform-specific:
+
+- `UserAbortedTurn` / `UserSupplement` — interactive turn control.
+- `BailianCLIError` / `MCPError` — Bailian platform failures
+ ([Platforms](platforms.md#bailian)).
+- `RetriesExhausted` — provider hardening gave up
+ ([Providers](providers.md#hardening)).
+
+::: dashscope_agenticx.utils.exceptions.UserAbortedTurn
+
+::: dashscope_agenticx.utils.exceptions.UserSupplement
\ No newline at end of file
diff --git a/docs/en/reference/governance.md b/docs/en/reference/governance.md
new file mode 100644
index 0000000..73cb6c4
--- /dev/null
+++ b/docs/en/reference/governance.md
@@ -0,0 +1,125 @@
+---
+description: "Permissions, sandbox, audit, hooks, scheduling, and the execution engine API reference."
+---
+# Governance & Engine
+
+Governance covers permission policy, OS sandboxing, audit logging, event
+hooks, and scheduled tasks. The engine layer is the turn execution
+kernel: model invocation, tool coordination, prompt assembly, acceptance
+gates, and deliverable collection.
+
+See [Security, Platform & MCP](../guides/security-and-platform.md) and
+[Subagents, Hooks & Memory](../guides/agent-patterns.md) for the
+user-facing flows (`permissions.toml`, `hooks.toml`, `/cron`, `/rule`).
+
+## Permissions
+
+::: dashscope_agenticx.permission.PermissionPolicy
+
+::: dashscope_agenticx.permission.load_permission_policy
+
+::: dashscope_agenticx.permission.load_permissions_file
+
+::: dashscope_agenticx.permission.get_permission_policy
+
+::: dashscope_agenticx.permission.set_permission_policy
+
+::: dashscope_agenticx.permission.configure_permission_policy
+
+## Sandbox
+
+::: dashscope_agenticx.sandbox.detect_backend
+
+::: dashscope_agenticx.sandbox.available
+
+::: dashscope_agenticx.sandbox.is_enabled
+
+::: dashscope_agenticx.sandbox.set_enabled
+
+::: dashscope_agenticx.sandbox.build_argv
+
+::: dashscope_agenticx.sandbox.seatbelt_profile
+
+::: dashscope_agenticx.sandbox.bwrap_argv
+
+::: dashscope_agenticx.sandbox.is_sandboxed_path
+
+## Audit
+
+::: dashscope_agenticx.audit.AuditEvent
+
+::: dashscope_agenticx.audit.AuditLogger
+
+::: dashscope_agenticx.audit.get_audit_logger
+
+::: dashscope_agenticx.audit.configure_audit_logger
+
+## Hooks
+
+::: dashscope_agenticx.hooks.Hook
+
+::: dashscope_agenticx.hooks.HookBus
+
+::: dashscope_agenticx.hooks.HookContext
+
+::: dashscope_agenticx.hooks.HookActionResult
+
+::: dashscope_agenticx.hooks.HookDispatchResult
+
+::: dashscope_agenticx.hooks.create_hook_bus
+
+## Scheduling
+
+::: dashscope_agenticx.scheduler.Scheduler
+
+::: dashscope_agenticx.scheduler.CronJob
+
+::: dashscope_agenticx.scheduler.ScheduleSpec
+
+::: dashscope_agenticx.scheduler.SkillInvocation
+
+::: dashscope_agenticx.scheduler.parse_cron_add
+
+::: dashscope_agenticx.scheduler.next_cron_fire
+
+## Execution kernel
+
+::: dashscope_agenticx.engine.ModelInvoker
+
+::: dashscope_agenticx.engine.RunGuards
+
+::: dashscope_agenticx.engine.ToolCoordinator
+
+::: dashscope_agenticx.engine.SessionPersistence
+
+::: dashscope_agenticx.executor.Executor
+
+::: dashscope_agenticx.executor.ToolOutcome
+
+::: dashscope_agenticx.executor.classify_tool_text
+
+::: dashscope_agenticx.prompt_pipeline.PromptContext
+
+::: dashscope_agenticx.prompt_pipeline.default_pipeline
+
+::: dashscope_agenticx.acceptance.AcceptanceGate
+
+::: dashscope_agenticx.acceptance.GateVerdict
+
+::: dashscope_agenticx.acceptance.discover_acceptance_command
+
+::: dashscope_agenticx.deliverable.collect_deliverables
+
+::: dashscope_agenticx.deliverable.surface_deliverables
+
+## Subagents & delegation
+
+::: dashscope_agenticx.agents.subagents.SubagentDef
+
+::: dashscope_agenticx.agents.subagents.discover_subagents
+
+::: dashscope_agenticx.agents.subagent.bind_subagent_context
+
+::: dashscope_agenticx.agents.subagent.register_subagent_tool
+
+::: dashscope_agenticx.agents.delegate.bind_delegate_context
\ No newline at end of file
diff --git a/docs/en/reference/memory.md b/docs/en/reference/memory.md
new file mode 100644
index 0000000..4160837
--- /dev/null
+++ b/docs/en/reference/memory.md
@@ -0,0 +1,65 @@
+---
+description: "Memory managers, session persistence, local history, and context compression API reference."
+---
+# Memory & Sessions
+
+AgenticX keeps conversation state at three levels: in-turn session
+history, persistent per-session files under `.agenticx/session//`,
+and long-term memory via the configured platform (Bailian by default,
+local otherwise). Context compression keeps long runs inside the model
+window.
+
+See [Subagents, Hooks & Memory](../guides/agent-patterns.md) for the
+user-facing `/memory`, `/session`, and `/profile` flows.
+
+## Memory manager
+
+::: dashscope_agenticx.memory.manager.MemoryManager
+
+::: dashscope_agenticx.memory.manager.SessionMemory
+
+::: dashscope_agenticx.memory.manager.PersistentMemory
+
+## Sessions
+
+::: dashscope_agenticx.session.SessionManager
+
+::: dashscope_agenticx.session.SessionMeta
+
+::: dashscope_agenticx.session.get_session_manager
+
+::: dashscope_agenticx.session.set_session_manager
+
+## Session event log
+
+::: dashscope_agenticx.session_events.SessionEventLog
+
+::: dashscope_agenticx.session_events.project_session_state
+
+::: dashscope_agenticx.session_events.latest_snapshot_messages
+
+## Local platform storage
+
+::: dashscope_agenticx.platforms.local.memory.LocalMemoryClient
+
+::: dashscope_agenticx.platforms.local.history.store_history
+
+::: dashscope_agenticx.platforms.local.history.list_history
+
+::: dashscope_agenticx.platforms.local.history.search_history
+
+::: dashscope_agenticx.platforms.local.history.export_history
+
+## Context compression
+
+::: dashscope_agenticx.compression.compress_messages
+
+::: dashscope_agenticx.compression.should_compress
+
+::: dashscope_agenticx.compression.estimate_tokens
+
+::: dashscope_agenticx.compression.estimate_message_tokens
+
+::: dashscope_agenticx.compression.preserve_recent_messages
+
+::: dashscope_agenticx.compression.shrink_old_tool_messages
\ No newline at end of file
diff --git a/docs/en/reference/platforms.md b/docs/en/reference/platforms.md
new file mode 100644
index 0000000..ad798e8
--- /dev/null
+++ b/docs/en/reference/platforms.md
@@ -0,0 +1,74 @@
+---
+description: "Platform protocols, Bailian CLI/MCP clients, MCP server mode, and the local HTTP API reference."
+---
+# Platforms, MCP & Server
+
+Platforms supply memory, knowledge, and CLI capabilities. The default
+`bailian` platform wraps the Bailian CLI and MCP services; `local`
+keeps everything on disk. AgenticX can also expose its own tools to
+other MCP clients (`agenticx mcp-server`) and serve a token-authenticated
+localhost HTTP API (`agenticx serve`).
+
+See [Security, Platform & MCP](../guides/security-and-platform.md) for
+setup and usage.
+
+## Platform protocols
+
+::: dashscope_agenticx.platforms.base.MemoryProvider
+
+::: dashscope_agenticx.platforms.base.MemoryNode
+
+::: dashscope_agenticx.platforms.base.MemoryLibrary
+
+::: dashscope_agenticx.platforms.base.SearchResult
+
+::: dashscope_agenticx.platforms.base.KBProvider
+
+::: dashscope_agenticx.platforms.base.DataProvider
+
+::: dashscope_agenticx.platforms.base.PromptProvider
+
+## Factories
+
+::: dashscope_agenticx.platforms.get_memory_provider
+
+::: dashscope_agenticx.platforms.get_cli_provider
+
+## Bailian
+
+::: dashscope_agenticx.platforms.bailian.cli.BailianCLIClient
+
+::: dashscope_agenticx.platforms.bailian.cli.CLIResult
+
+::: dashscope_agenticx.platforms.bailian.cli.BailianCLIError
+
+::: dashscope_agenticx.platforms.bailian.mcp.MCPClient
+
+::: dashscope_agenticx.platforms.bailian.mcp.MCPError
+
+## MCP server mode
+
+Expose AgenticX tools over MCP stdio (`agenticx mcp-server`):
+
+::: dashscope_agenticx.mcp_server.tools_to_mcp_schema
+
+::: dashscope_agenticx.mcp_server.handle_mcp_request
+
+::: dashscope_agenticx.mcp_server.run_stdio_server
+
+::: dashscope_agenticx.mcp_server.main
+
+::: dashscope_agenticx.mcp_stdio.StdioMCPClient
+
+## Local HTTP API
+
+`agenticx serve` binds to localhost only and requires a bearer token;
+non-localhost bind addresses are rejected.
+
+::: dashscope_agenticx.server.LocalAPI
+
+::: dashscope_agenticx.server.create_server
+
+::: dashscope_agenticx.server.serve
+
+::: dashscope_agenticx.server.generate_server_token
\ No newline at end of file
diff --git a/docs/en/reference/providers.md b/docs/en/reference/providers.md
new file mode 100644
index 0000000..4548ef2
--- /dev/null
+++ b/docs/en/reference/providers.md
@@ -0,0 +1,74 @@
+---
+description: "LLM provider protocol, built-in providers, routing, and hardening API reference."
+---
+# Providers
+
+Providers adapt model backends to a single protocol (`LLMProvider`:
+`chat`, `chat_stream`, `aclose`). The built-in Tongyi provider talks to
+DashScope over httpx directly; OpenAI and Anthropic providers are
+optional extras.
+
+| Provider | Install | Notes |
+|---|---|---|
+| `tongyi` (default) | core | DashScope native generation endpoints over httpx |
+| `openai` | `pip install "dashscope-agenticx[provider-openai]"` | OpenAI and compatible gateways |
+| `anthropic` | `pip install "dashscope-agenticx[provider-anthropic]"` | Anthropic Messages API |
+
+Custom providers can be declared in `.agenticx/custom-extensions.toml`
+without writing Python — see
+[Tools, Skills & Experts](../guides/tools-and-skills.md).
+
+Routing honors `Config.fallback_providers`, MaaS gateway settings
+(`workspace`, `region`, `maas_api_key`), and per-provider profiles built
+from config. Transient failures are retried by the hardening wrapper;
+`provider.switched` events report routing changes.
+
+## Protocol & shared types
+
+::: dashscope_agenticx.providers.base.LLMProvider
+
+::: dashscope_agenticx.providers.base.ToolCall
+
+::: dashscope_agenticx.providers.base.LLMResponse
+
+::: dashscope_agenticx.providers.base.LLMChunk
+
+## Built-in providers
+
+::: dashscope_agenticx.providers.tongyi.TongyiProvider
+
+::: dashscope_agenticx.providers.openai.OpenAIProvider
+
+::: dashscope_agenticx.providers.anthropic.AnthropicProvider
+
+## Profiles & routing
+
+::: dashscope_agenticx.providers.profile.ProviderProfile
+
+::: dashscope_agenticx.providers.profile.ProviderChain
+
+::: dashscope_agenticx.providers.profile.build_profiles_from_config
+
+::: dashscope_agenticx.providers.profile.validate_key_for_profile
+
+::: dashscope_agenticx.providers.profile.maas_gateway
+
+::: dashscope_agenticx.providers.profile.warn_legacy_gateway
+
+## Hardening
+
+::: dashscope_agenticx.providers.hardening.HardenedProvider
+
+::: dashscope_agenticx.providers.hardening.RetriesExhausted
+
+::: dashscope_agenticx.providers.hardening.is_retryable_error
+
+::: dashscope_agenticx.providers.hardening.account_error_hint
+
+## Protocol adapters
+
+::: dashscope_agenticx.providers.adapter.anthropic_to_openai_request
+
+::: dashscope_agenticx.providers.adapter.openai_to_anthropic_response
+
+::: dashscope_agenticx.providers.adapter.anthropic_to_openai_response
\ No newline at end of file
diff --git a/docs/en/reference/sdk.md b/docs/en/reference/sdk.md
new file mode 100644
index 0000000..db43c54
--- /dev/null
+++ b/docs/en/reference/sdk.md
@@ -0,0 +1,83 @@
+---
+description: "AgenticX embeddable SDK entry points and configuration API reference."
+---
+# SDK & Config
+
+The embeddable SDK lives in `dashscope_agenticx.sdk` — a stable, typed
+surface on top of the agent runtime for scripts, CI pipelines, IDE
+plugins, and other Python programs. For a task-oriented walkthrough see
+[Embedding the SDK](../guides/sdk.md); for config files and environment
+variables see [Configuration](../configuration.md).
+
+```python
+from dashscope_agenticx.sdk import run_once_sync
+
+print(run_once_sync("Summarize README.md"))
+```
+
+!!! note "Import path"
+ Import from `dashscope_agenticx.sdk`. The top-level package re-exports
+ the most common helpers, but the `sdk` module is the documented,
+ complete surface.
+
+## Configuration resolution
+
+`Config.load()` merges three layers, in increasing priority:
+
+1. Global config: `~/.config/AgenticX/config.toml`
+2. Workspace config: `./.agenticx/config.toml`
+3. Environment variables fill remaining gaps (`DASHSCOPE_API_KEY`,
+ `ANTHROPIC_API_KEY`, `OPENAI_API_KEY`, `AGENTICX_WORKSPACE`,
+ `AGENTICX_REGION`, `AGENTICX_MAAS_API_KEY`, …)
+
+`AGENTICX_PROVIDER`, `AGENTICX_MODEL`, `AGENTICX_OPENAI_BASE_URL` and
+`AGENTICX_MCP_SERVERS` force-override the resolved values.
+`load_config()` in the SDK applies caller-supplied arguments only where
+the resolved config still has gaps.
+
+`Config.api_key` is a property that routes to the per-provider key field
+(`tongyi_api_key`, `anthropic_api_key`, `openai_api_key`) based on
+`Config.provider`.
+
+## SDK entry points
+
+::: dashscope_agenticx.sdk
+ options:
+ heading_level: 3
+ members:
+ - load_config
+ - create_agent
+ - run_events
+ - run_stream
+ - run_once
+ - run_once_sync
+ - run_interactive
+
+## Config
+
+::: dashscope_agenticx.config.Config
+
+Key defaults: `max_turns=50`, `timeout=30` (seconds per model request),
+`platform="bailian"`, `memory_enabled=True`, `session_persist=True`.
+
+## Nested config types
+
+::: dashscope_agenticx.config.MCPServerConfig
+
+::: dashscope_agenticx.config.SubagentConfig
+
+::: dashscope_agenticx.config.DelegationConfig
+
+## Model helpers
+
+::: dashscope_agenticx.config.DEFAULT_MODEL
+
+::: dashscope_agenticx.config.context_window_for_model
+
+::: dashscope_agenticx.config.normalize_model_name
+
+::: dashscope_agenticx.config.register_custom_model
+
+::: dashscope_agenticx.config.is_vision_model
+
+::: dashscope_agenticx.config.is_audio_model
\ No newline at end of file
diff --git a/docs/en/reference/tools.md b/docs/en/reference/tools.md
new file mode 100644
index 0000000..298aabb
--- /dev/null
+++ b/docs/en/reference/tools.md
@@ -0,0 +1,118 @@
+---
+description: "Built-in tools, the @tool registry, skills, apps, and runtime extensions API reference."
+---
+# Tools & Skills
+
+Tools are plain Python functions registered with the `@tool` decorator;
+the registry offers their schemas to the model and enforces permission
+levels at execution time. Skills are markdown playbooks the agent can
+load on demand; apps and experts package skills plus configuration.
+
+For walkthroughs see
+[Tools, Skills & Experts](../guides/tools-and-skills.md).
+
+## Registry
+
+::: dashscope_agenticx.tools.registry.tool
+
+::: dashscope_agenticx.tools.registry.ToolRegistry
+
+::: dashscope_agenticx.tools.registry.ToolDefinition
+
+::: dashscope_agenticx.tools.registry.PermissionLevel
+
+::: dashscope_agenticx.tools.registry.RuntimeToolRegistry
+
+::: dashscope_agenticx.tools.registry.bind_tool_registry
+
+## Built-in tools
+
+Core tools ship with the base install:
+
+::: dashscope_agenticx.tools.filesystem
+
+::: dashscope_agenticx.tools.shell
+
+::: dashscope_agenticx.tools.session
+
+::: dashscope_agenticx.tools.checkpoint
+
+::: dashscope_agenticx.tools.skills
+
+::: dashscope_agenticx.tools.platform
+
+Optional tools need extras; their modules import lazily, so the
+reference below is safe to browse on a core install:
+
+| Module | Extra |
+|---|---|
+| `tools.web_search` | `dashscope-agenticx[web]` |
+| `tools.browser` | `dashscope-agenticx[browser]` |
+| `tools.camera`, `tools.vision` | `dashscope-agenticx[media]` |
+
+::: dashscope_agenticx.tools.web_search
+
+::: dashscope_agenticx.tools.browser
+
+::: dashscope_agenticx.tools.camera
+
+::: dashscope_agenticx.tools.vision
+
+## Skills
+
+::: dashscope_agenticx.skills.base.Skill
+
+::: dashscope_agenticx.skills.base.register
+
+::: dashscope_agenticx.skills.base.load_skill_files
+
+::: dashscope_agenticx.skills.base.register_skill_file
+
+::: dashscope_agenticx.skills.base.list_skills
+
+::: dashscope_agenticx.skills.base.render_skill
+
+::: dashscope_agenticx.skills.manager.SkillManager
+
+::: dashscope_agenticx.skills.manager.get_skill_manager
+
+## Apps & experts
+
+::: dashscope_agenticx.apps.manifest.AppManifest
+
+::: dashscope_agenticx.apps.manifest.AppTrust
+
+::: dashscope_agenticx.apps.manifest.AppPermissions
+
+::: dashscope_agenticx.apps.manifest.load_app_manifest
+
+::: dashscope_agenticx.apps.manifest.compute_app_checksum
+
+::: dashscope_agenticx.apps.manifest.permission_diff
+
+::: dashscope_agenticx.apps.store.install
+
+::: dashscope_agenticx.apps.store.AppInstallResult
+
+::: dashscope_agenticx.apps.store.load_registry
+
+::: dashscope_agenticx.apps.store.runtime_compatible
+
+## Runtime extensions
+
+Declarative providers, tools, capabilities, and skills from
+`.agenticx/custom-extensions.toml`:
+
+::: dashscope_agenticx.extensions.CustomExtensions
+
+::: dashscope_agenticx.extensions.CustomProvider
+
+::: dashscope_agenticx.extensions.CustomTool
+
+::: dashscope_agenticx.extensions.CustomCapability
+
+::: dashscope_agenticx.extensions.CustomSkill
+
+::: dashscope_agenticx.extensions.CustomShellTool
+
+::: dashscope_agenticx.extensions.load_extensions
\ No newline at end of file
diff --git a/docs/en/release-notes.md b/docs/en/release-notes.md
new file mode 100644
index 0000000..90272cb
--- /dev/null
+++ b/docs/en/release-notes.md
@@ -0,0 +1,108 @@
+---
+description: "DashScope AgenticX release notes for 1.0.2, 1.0.1, and 1.0.0."
+---
+# Release Notes
+
+AgenticX follows [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
+The full history lives in the repository
+[`CHANGELOG.md`](https://github.com/dashscope/dashscope-agenticx/blob/main/CHANGELOG.md);
+this page summarizes the stable 1.0 releases.
+
+## 1.0.2 — 2026-11-19
+
+### Added
+
+- Bilingual (English / 中文) documentation site: quickstart, configuration,
+ CLI and slash-command reference, migration, guides (embedding the SDK,
+ tools & skills, subagents & memory, security & platform), developer guide,
+ and an API reference generated from source.
+- GitHub Actions workflow building the site with `mkdocs build --strict` on
+ pull requests and deploying to GitHub Pages on pushes to `main`.
+- README links to the published documentation site.
+
+### Changed
+
+- The doc-code consistency guard accepts the remote DashScope logo URL used
+ by the READMEs.
+
+### Fixed
+
+- Browser tool docstring argument indentation so the API reference parses
+ cleanly under `mkdocs build --strict`.
+
+## 1.0.1 — 2026-11-11
+
+### Added
+
+- End-to-end App Catalog installation and verification quick starts,
+ including the separate Expert activation step and one-shot `agenticx -c`
+ usage.
+- DashScope and MaaS request attribution through `x-dashscope-sdk-client`
+ and `x-dashscope-sdk-session-id` across Native, OpenAI-compatible,
+ Anthropic-compatible, MCP, ASR, and TTS requests. Third-party endpoints do
+ not receive these headers.
+
+### Changed
+
+- Expert management consistently uses `agenticx expert`, `/expert`,
+ `expert_repo`, and `expert_branch`; legacy Example command and
+ configuration names were removed.
+- English and Chinese guides cover the current CLI, interaction, Skill,
+ Session, and Server commands and clarify App installation versus Expert
+ activation.
+
+## 1.0.0 — 2026-11-10
+
+The first stable release of the DashScope AgenticX Runtime.
+
+### Added
+
+- TUI transcript blocks: Markdown replies, numbered turns, collapsible tool
+ output, and expanded per-turn/session statistics.
+- Tool-result truncation metadata and prompt-composition/usage-call details.
+- Full unit-test matrix and repository-wide pre-commit checks on main-branch
+ pushes and pull requests.
+- Tag builds prepare wheel/source distributions and platform binaries with
+ SHA-256 checksums in a draft GitHub Release for final review.
+
+### Changed
+
+- Package, CLI, SDK, and bundled App runtime requirements use the stable
+ `1.0.0` version.
+- Expert downloads default to the public
+ `dashscope/dashscope-agenticx-experts` repository on branch `main`;
+ explicit repository overrides remain supported. App Catalog downloads read
+ only `apps//`, with no fallback to legacy top-level Expert
+ directories.
+- Public guides and migration documentation live at the repository root;
+ source distributions exclude the internal `md/` directory.
+
+### Fixed (security & runtime highlights)
+
+- Runtime-local MCP/session/permission/extension state, child authorization
+ caches, and deterministic cleanup on exceptions and early stream closure.
+- Default confirmation covers write tools; explicit deny policies cannot be
+ bypassed through AUTO or automatic approval. Parallel delegates default to
+ read-only tools and do not import authorization grants.
+- App bundle path validation, manifest permission types, and permission
+ confirmation before installation writes. Expert templates reject implicit
+ executable code even when overwrite is requested.
+- Local Server execution refuses automatic local grants and rejects invalid
+ HTTP body lengths; IPv6 loopback and error-response redaction are covered.
+- Run hooks and custom shell tools substitute model-controlled values as
+ native process arguments, not shell syntax; parameterized pipelines, shell
+ interpreters, and dynamic executable/code/module names are rejected.
+- Credential assignments and private-key blocks are redacted from text,
+ event, and session payloads regardless of length or known key patterns;
+ TUI input history redacts credentials on save and migration.
+- Expert download/restore reject path traversal, symbolic links, and
+ overwrite of the managed backup directory.
+- Structured reasoning, plan, compression, and provider-fallback events
+ complement message/tool/permission events with sanitized payloads.
+- Pillow-backed vision/media require Python 3.11+; Python 3.10 retains base
+ Runtime support and the `all` extra omits Pillow on that version.
+
+## Upgrading
+
+See [Migrating to 1.0](migration.md) for legacy naming, one-way directory
+migration, and credential handling.
\ No newline at end of file
diff --git a/docs/hooks.py b/docs/hooks.py
new file mode 100644
index 0000000..671e25c
--- /dev/null
+++ b/docs/hooks.py
@@ -0,0 +1,141 @@
+# -*- coding: utf-8 -*-
+"""MkDocs hooks: surface the package version from _version.py in pages.
+
+Pages opt in with the ``{{ agenticx_version }}`` placeholder; the value is
+read from the source of truth at build time so docs never drift from the
+package.
+"""
+
+import re
+from pathlib import Path
+
+from mkdocs.structure.toc import AnchorLink, TableOfContents
+
+# Reference pages listing dozens of API symbols: even a section+symbol
+# outline floods the sidebar, so their "On this page" nav keeps only the
+# h2 section titles. Applies to both locales.
+_SECTION_ONLY_TOC_PAGES = {
+ "reference/agent.md",
+ "reference/providers.md",
+ "reference/tools.md",
+ "reference/memory.md",
+ "reference/platforms.md",
+ "reference/governance.md",
+}
+
+# The theme's static 404.html template renders once per i18n pass and the
+# last (zh) pass overwrites site/404.html, shipping a mixed-language shell.
+# Stash the en pass render context and reuse it for every later pass.
+_EN_404_CONTEXT = None
+
+
+def _read_version(docs_dir: str) -> str:
+ source = (
+ Path(docs_dir).parent / "src" / "dashscope_agenticx" / "_version.py"
+ )
+ match = re.search(
+ r'__version__\s*=\s*["\']([^"\']+)["\']',
+ source.read_text(encoding="utf-8"),
+ )
+ return match.group(1) if match else "unknown"
+
+
+def on_config(config):
+ config.extra["agenticx_version"] = _read_version(config.docs_dir)
+ # mkdocstrings inserts its stylesheet on every per-locale on_config
+ # pass, so the i18n rebuild emits the link twice; keep first occurrence.
+ config.extra_css = list(dict.fromkeys(config.extra_css))
+ return config
+
+
+def on_page_content(html, *, page, config, files):
+ # i18n folder structure prefixes src_uri with the locale (en/ or zh/)
+ parts = page.file.src_uri.split("/")
+ src = (
+ "/".join(parts[1:]) if parts[0] in ("en", "zh") else page.file.src_uri
+ )
+ if src in _SECTION_ONLY_TOC_PAGES:
+ # toc tokens nest sections under the leading h1; Material replaces
+ # the nav with that h1's children, so prune from the same place.
+ items = list(page.toc)
+ if items and items[0].level == 1:
+ items = items[0].children
+ sections = [
+ AnchorLink(item.title, item.id, item.level)
+ for item in items
+ if item.level == 2
+ ]
+ if sections:
+ sections[0].active = True
+ page.toc = TableOfContents(sections)
+ return html
+
+
+def on_page_markdown(markdown, *, page, config, files):
+ return markdown.replace(
+ "{{ agenticx_version }}",
+ config.extra.get("agenticx_version", "unknown"),
+ )
+
+
+def _snapshot_404_context(context, config):
+ """Snapshot a 404 render context with explicit language destinations."""
+ # Plain-dict snapshot: Config/Theme are UserDict/MutableMapping whose
+ # internal storage copy.copy would share, and i18n mutates it per pass.
+ snapshot = dict(context)
+ cfg = dict(config)
+ cfg["theme"] = dict(config.theme)
+ cfg["extra"] = dict(config.extra)
+ # Static theme templates have no page context. Without this override,
+ # the i18n plugin leaves the last content page's alternates behind.
+ base_url = context.get("base_url", "/")
+ cfg["extra"]["alternate"] = [
+ {"link": base_url, "lang": "en", "name": "English"},
+ {
+ "link": base_url + "zh/404/",
+ "lang": "zh",
+ "name": "简体中文",
+ },
+ ]
+ snapshot["config"] = cfg
+ return snapshot
+
+
+def on_template_context(context, *, template_name, config):
+ global _EN_404_CONTEXT
+ if template_name != "404.html":
+ return context
+ if config.theme.get("language", "en") == "en":
+ _EN_404_CONTEXT = _snapshot_404_context(context, config)
+ return _EN_404_CONTEXT
+ if _EN_404_CONTEXT is None:
+ # mkdocs serve can rebuild only the zh pass; static destinations
+ # must not depend on an earlier en render having populated the
+ # cache.
+ return _snapshot_404_context(context, config)
+ # Fresh copy per pass: later plugin hooks may mutate the returned dict.
+ return dict(_EN_404_CONTEXT)
+
+
+def on_post_build(*, config):
+ """Keep the localized 404 page out of the sitemap.
+
+ mkdocs only special-cases the root ``404.html``; the zh 404 lives at
+ ``zh/404/`` and would otherwise be listed as a regular page.
+ """
+ import gzip
+
+ sitemap = Path(config.site_dir) / "sitemap.xml"
+ if not sitemap.exists():
+ return
+ text = sitemap.read_text(encoding="utf-8")
+ pruned = text
+ for block in re.findall(r".*?", text, re.S):
+ if re.search(r"[^<]*/404/", block):
+ pruned = pruned.replace(block, "", 1)
+ if pruned == text:
+ return
+ sitemap.write_text(pruned, encoding="utf-8")
+ compressed = sitemap.with_suffix(".xml.gz")
+ if compressed.exists():
+ compressed.write_bytes(gzip.compress(pruned.encode("utf-8")))
diff --git a/docs/overrides/404.html b/docs/overrides/404.html
new file mode 100644
index 0000000..3c0739c
--- /dev/null
+++ b/docs/overrides/404.html
@@ -0,0 +1,38 @@
+{% extends "base.html" %}
+
+{#-
+ Override of the theme's static 404 template. mkdocs renders it once,
+ without a page context and with absolute URLs, because GitHub Pages
+ serves it for every missing path. zh readers hop to zh/404/ via the
+ script below; the bilingual link covers JS-disabled clients.
+-#}
+{% block htmltitle %}
+ Page not found - {{ config.site_name }}
+{% endblock %}
+
+{% block content %}
+
Page not found
+
+ The page you requested does not exist — it may have been moved or
+ renamed.
+
+
+{% endblock %}
\ No newline at end of file
diff --git a/docs/overrides/main.html b/docs/overrides/main.html
new file mode 100644
index 0000000..d0b4289
--- /dev/null
+++ b/docs/overrides/main.html
@@ -0,0 +1,64 @@
+{% extends "base.html" %}
+
+{% block htmltitle %}
+ {% if page and page.url == "zh/" %}
+ {# The i18n homepage is not marked as page.is_homepage by Material. #}
+ {{ config.site_name }}
+ {% else %}
+ {{ super() }}
+ {% endif %}
+{% endblock %}
+
+{% block extrahead %}
+ {{ super() }}
+ {% if page and page.url == "zh/404/" %}
+ {# The localized 404 is a live 200 page; keep it out of search engines. #}
+
+ {% endif %}
+{% endblock %}
+
+{# Elastic-style per-page action block; desktop shows the sidebar copy
+ from partials/toc.html instead, this one serves viewports <60em. #}
+{% block content %}
+ {{ super() }}
+ {% set zh = (i18n_page_locale | default("en")) == "zh" %}
+
+{% endblock %}
+
+{% block scripts %}
+ {{ super() }}
+ {# Below 60em Material renders search as a fullscreen panel that swallows
+ every click, and the decorative .md-search__overlay circle has
+ pointer-events: none -- so unlike desktop, clicking outside can never
+ toggle #__search and the dialog looks stuck. Restore the desktop
+ "click elsewhere to close" behavior on narrow viewports: a click on
+ the panel outside the form, suggestions and result links closes it. #}
+
+{% endblock %}
\ No newline at end of file
diff --git a/docs/overrides/partials/alternate.html b/docs/overrides/partials/alternate.html
new file mode 100644
index 0000000..536f75a
--- /dev/null
+++ b/docs/overrides/partials/alternate.html
@@ -0,0 +1,19 @@
+{#-
+ Segmented EN | 中 language switch instead of Material's translate-icon
+ dropdown (the same 文A button fastapi.tiangolo.com uses). Two locales
+ make a dropdown pointless: show both, highlight the active one, switch
+ in a single click. Overrides partials/alternate.html.
+-#}
+{% set current = i18n_page_locale | default("en") %}
+
+
+
\ No newline at end of file
diff --git a/docs/overrides/partials/header.html b/docs/overrides/partials/header.html
new file mode 100644
index 0000000..64625dc
--- /dev/null
+++ b/docs/overrides/partials/header.html
@@ -0,0 +1,92 @@
+{#-
+ Material header with keyboard-operable mobile drawer and search toggles.
+ The drawer uses a native button for Enter/Space behavior; the search toggle
+ must stay a