§9 acceptance: grep-zero sweep — every internal x.ai/grok identifier renamed

The PRD's first acceptance gate now holds: grep -RinE '\bx\.ai\b|grok'
crates/ --include='*.rs' → 0 matches (exempt: NOTICE and third-party
license archives, README provenance, and the required 'Based on Grok
Build Open Source' attribution, now sourced from version_attribution.txt).

Wire-visible renames (both sides in this repo, changed in lockstep):
- Auth method id 'grok.com' → 'kimi-code' (AuthMethodKind::KimiCode).
- Every x.ai/* and _x.ai/* ACP ext method and meta key → kigi/* /
  _kigi/* (~200 names; grokShell → kigiShell). Session-file replay keeps
  a read-side alias for the legacy '_x.ai/session/update' method so
  existing updates.jsonl histories load; writes emit only the new name
  (both directions test-pinned).
- Agent types grok-build* → kigi* with a documented legacy-prefix alias
  at resolution time so persisted sessions keep resolving.
- ToolNamespace/BuiltinAgentName GrokBuild* → Kigi* (wire snake_case
  kigi/kigi_concise/kigi_hashline; schema regenerated); grok_build
  implementation dirs renamed to kigi*.
- x-grok-* headers → x-kigi-*, __GROK_* sentinels → __KIGI_*, themes
  grokday/groknight → kigiday/kiginight (old persisted values fall back
  to the default theme), web_fetch allowlist xAI hosts → kimi.com +
  moonshot platforms, changelog CDN → this repo, grok-build changelog
  archives deleted.
- BYOK default endpoint removed: [endpoints] api_base_url is now truly
  optional with NO default — consumers fail fast with the flag name when
  unset (no silent x.ai egress). Mock harnesses inject it explicitly.
- System-prompt identity fixed: 'released by xAI' → 'an unofficial
  community CLI for Kimi' (template + regenerated encrypted form).

Also repaired pre-existing grok-era test debt found by the sweep: the
stale trace_classify default-model pin, the grok-pager UA label test,
pty-harness stale-binary reuse and non-hermetic moonshot routing (a PTY
test could previously reach the real api.moonshot.cn), and the outdated
oauth fixture scope key.

Gates: §9 grep 0; fmt clean; workspace check/clippy 0/0 (-D warnings);
FULL cargo test --workspace: 234 suites, 21,961 passed, 0 failed;
deny advisories ok.
This commit is contained in:
2026-07-18 02:48:46 -04:00
parent 86e3724310
commit 6f31415ed6
1056 changed files with 8410 additions and 18307 deletions
@@ -1,20 +1,20 @@
# Project Rules (AGENTS.md)
Project rules let you configure Grok per project or directory. By placing an AGENTS.md file in your repository, you can set coding conventions, build instructions, style guides, and any other instructions that Grok should follow when working in that codebase.
Project rules let you configure Kigi per project or directory. By placing an AGENTS.md file in your repository, you can set coding conventions, build instructions, style guides, and any other instructions that Kigi should follow when working in that codebase.
---
## What Are Project Rules?
Project rules are Markdown files that Grok reads and adds to its context. Grok follows their content for every interaction in that tree.
Project rules are Markdown files that Kigi reads and adds to its context. Kigi follows their content for every interaction in that tree.
This is the primary mechanism for teaching Grok about your project's conventions, so you need not restate them each session.
This is the primary mechanism for teaching Kigi about your project's conventions, so you need not restate them each session.
---
## Supported File Names
Grok checks for these filenames (in this order) within each directory:
Kigi checks for these filenames (in this order) within each directory:
- `Agents.md`
- `Claude.md`
@@ -23,11 +23,11 @@ Grok checks for these filenames (in this order) within each directory:
- `AGENT.md`
- `AGENTS.md`
Grok loads every matching file in a directory, so a folder that contains both `AGENTS.md` and `CLAUDE.md` contributes both. On case-insensitive filesystems, names that resolve to the same file (such as `Agents.md` and `AGENTS.md`) are deduplicated and counted once. `Claude.md`, `CLAUDE.md`, and `CLAUDE.local.md` are supported for compatibility with Claude Code workflows. When Claude compatibility is enabled (the default), Grok also scans your home-level `~/.claude/` directory for these filenames and, at each directory level, checks `.claude/CLAUDE.md` and `.claude/CLAUDE.local.md` -- the locations Claude Code uses for project memory. With Cursor compatibility enabled, the home-level `~/.cursor/` directory is scanned the same way.
Kigi loads every matching file in a directory, so a folder that contains both `AGENTS.md` and `CLAUDE.md` contributes both. On case-insensitive filesystems, names that resolve to the same file (such as `Agents.md` and `AGENTS.md`) are deduplicated and counted once. `Claude.md`, `CLAUDE.md`, and `CLAUDE.local.md` are supported for compatibility with Claude Code workflows. When Claude compatibility is enabled (the default), Kigi also scans your home-level `~/.claude/` directory for these filenames and, at each directory level, checks `.claude/CLAUDE.md` and `.claude/CLAUDE.local.md` -- the locations Claude Code uses for project memory. With Cursor compatibility enabled, the home-level `~/.cursor/` directory is scanned the same way.
### Rules Directories
In addition to AGENTS.md files, Grok scans for `*.md` files in rules directories at each level (`<dir>`) from the repo root to the current working directory:
In addition to AGENTS.md files, Kigi scans for `*.md` files in rules directories at each level (`<dir>`) from the repo root to the current working directory:
| Location | Notes |
|----------|-------|
@@ -35,13 +35,13 @@ In addition to AGENTS.md files, Grok scans for `*.md` files in rules directories
| `<dir>/.claude/rules/` | Claude compatibility (configurable) |
| `<dir>/.cursor/rules/` | Cursor compatibility (configurable) |
Grok scans the Claude and Cursor rules directories by default. To disable scanning for a specific vendor, set its cell in the `[compat]` config section or the corresponding environment variable. See [Configuration](05-configuration.md#harness-compatibility) for details.
Kigi scans the Claude and Cursor rules directories by default. To disable scanning for a specific vendor, set its cell in the `[compat]` config section or the corresponding environment variable. See [Configuration](05-configuration.md#harness-compatibility) for details.
---
## How Discovery Works
Grok scans for project rules in this order:
Kigi scans for project rules in this order:
1. **Global rules**: `~/.kigi/` (applies to all projects)
2. **Repo rules**: If inside a git repo, every directory from the repo root down to the current working directory (inclusive)
@@ -60,16 +60,16 @@ Given this project structure:
AGENTS.md # "Use CSS modules for styling."
```
When Grok runs in `~/projects/my-app/src/components/`, it loads all three files. The instructions accumulate, so Grok sees all of them.
When Kigi runs in `~/projects/my-app/src/components/`, it loads all three files. The instructions accumulate, so Kigi sees all of them.
### Deeper Files Take Precedence
Grok orders the files from the repo root to the current working directory, so files in deeper directories appear later in its context and take precedence when instructions conflict. In the example above, if the root says "Use styled-components" but `components/AGENTS.md` says "Use CSS modules", the CSS modules instruction wins because it appears later.
Kigi orders the files from the repo root to the current working directory, so files in deeper directories appear later in its context and take precedence when instructions conflict. In the example above, if the root says "Use styled-components" but `components/AGENTS.md` says "Use CSS modules", the CSS modules instruction wins because it appears later.
### Auto-Loading Behavior
- Grok loads the files from the repo root to the current working directory automatically at session start.
- When Grok reads, lists, or edits files in directories outside that initial set, it detects any project instruction files there, notes their paths, and reads them when they apply to the task.
- Kigi loads the files from the repo root to the current working directory automatically at session start.
- When Kigi reads, lists, or edits files in directories outside that initial set, it detects any project instruction files there, notes their paths, and reads them when they apply to the task.
---
@@ -155,18 +155,18 @@ my-monorepo/
To add rules for a single session without editing files, pass `--rules` (alias `--append-system-prompt`):
```bash
grok --rules "Always use TypeScript. Prefer functional components."
kigi --rules "Always use TypeScript. Prefer functional components."
```
Grok appends this text to the session's system prompt. Use it for session-specific customization.
Kigi appends this text to the session's system prompt. Use it for session-specific customization.
To replace the system prompt entirely, pass `--system-prompt-override` (alias `--system-prompt`). Grok uses the text verbatim and skips both the default system prompt and `--rules`. (Text passed with `--rules`, by contrast, is wrapped in a `<human_rules>` block and appended to the default prompt.)
To replace the system prompt entirely, pass `--system-prompt-override` (alias `--system-prompt`). Kigi uses the text verbatim and skips both the default system prompt and `--rules`. (Text passed with `--rules`, by contrast, is wrapped in a `<human_rules>` block and appended to the default prompt.)
---
## File Size
Grok loads each project instruction file in full; there is no character cap and no truncation. Even so, keep instructions concise and focused. Shorter, specific rules are easier for Grok to follow than long ones, and every file you load consumes context.
Kigi loads each project instruction file in full; there is no character cap and no truncation. Even so, keep instructions concise and focused. Shorter, specific rules are easier for Kigi to follow than long ones, and every file you load consumes context.
---
@@ -179,7 +179,7 @@ Files ignored by `.gitignore` are skipped during discovery. To keep personal ove
CLAUDE.local.md
```
As top-level instruction files, Grok discovers only the recognized filenames listed under [Supported File Names](#supported-file-names) — not custom names such as `AGENTS.local.md` or `notes.md`. (Inside a rules directory such as `.kigi/rules/`, every `*.md` file is loaded regardless of name.)
As top-level instruction files, Kigi discovers only the recognized filenames listed under [Supported File Names](#supported-file-names) — not custom names such as `AGENTS.local.md` or `notes.md`. (Inside a rules directory such as `.kigi/rules/`, every `*.md` file is loaded regardless of name.)
---
@@ -202,13 +202,13 @@ These are all optional. See the respective guides for details on each.
## Inspecting Loaded Rules
Use `grok inspect` to see all loaded project instructions:
Use `kigi inspect` to see all loaded project instructions:
```bash
grok inspect
kigi inspect
```
This shows each project instruction file it finds, with its path and approximate token count. Use it to confirm Grok picks up your rules.
This shows each project instruction file it finds, with its path and approximate token count. Use it to confirm Kigi picks up your rules.
---