Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
2a49109
fix(hook): normalize hooks.json lifecycle state
papperrollinggery Apr 30, 2026
baeb5ab
fix(compiler): harden relation inference output handling
papperrollinggery Apr 30, 2026
482c9ac
feat(route): add combo metadata and high-frequency routes
papperrollinggery Apr 30, 2026
45d27e1
feat(ui): bundle local cytoscape asset
papperrollinggery Apr 30, 2026
cad54e5
docs: update v1.5 routing and hook guidance
papperrollinggery Apr 30, 2026
b69e353
fix(hook): back up hooks file during install
papperrollinggery Apr 30, 2026
a95a0e3
fix(compiler): gate invalid relation output
papperrollinggery Apr 30, 2026
55076be
fix(route): render combo commands for target
papperrollinggery Apr 30, 2026
cf4ba15
fix(ui): harden config and compile controls
papperrollinggery Apr 30, 2026
09c6402
docs: align safety and gui behavior
papperrollinggery Apr 30, 2026
ec84d0b
feat(compiler): expose persisted compile errors
papperrollinggery Apr 30, 2026
5692941
fix(hook): narrow lazybrain hook detection
papperrollinggery Apr 30, 2026
d03b580
fix(config): share config update validation
papperrollinggery Apr 30, 2026
a603052
docs: document compile errors and config validation
papperrollinggery Apr 30, 2026
1176bc9
fix(hook): avoid public audit marker
papperrollinggery Apr 30, 2026
232d83c
fix(ui): run scan before gui compile
papperrollinggery Apr 30, 2026
98a15df
fix(compile): preserve relation error gates
papperrollinggery Apr 30, 2026
cf2f6e2
docs: list packaged graph asset
papperrollinggery Apr 30, 2026
ae885ec
feat(ready): add release readiness mode
papperrollinggery Apr 30, 2026
59d45b4
feat(mcp): add harness observation envelopes
papperrollinggery Apr 30, 2026
c3392d6
docs: add adaptive routing roadmap
papperrollinggery Apr 30, 2026
912e984
feat(route): add adaptive choice set
papperrollinggery Apr 30, 2026
5a978c7
feat(route): rank adaptive model and mode choices
papperrollinggery Apr 30, 2026
6f3ef65
feat(doctor): report capability conflicts
papperrollinggery Apr 30, 2026
e8b1b35
feat(route): preserve registry conflict metadata
papperrollinggery Apr 30, 2026
165fceb
feat(route): learn local choice preferences
papperrollinggery Apr 30, 2026
e221bf8
fix(route): preserve high-risk choice metadata
papperrollinggery Apr 30, 2026
dd671b1
docs: update adaptive routing handoff
papperrollinggery Apr 30, 2026
fd91ebd
docs: correct routing benchmark handoff
papperrollinggery Apr 30, 2026
f017fc5
fix(matcher): prioritize specialized intents
papperrollinggery Apr 30, 2026
6609f1a
fix(matcher): reach full benchmark coverage
papperrollinggery Apr 30, 2026
ba7d3db
fix(doctor): downgrade equivalent provider duplicates
papperrollinggery Apr 30, 2026
5eb3d23
docs: add next-stage adaptive routing blueprint
papperrollinggery May 1, 2026
b471f8d
feat(route): add conflict action guidance
papperrollinggery May 1, 2026
f598586
test(route): lock adaptive policy boundaries
papperrollinggery May 1, 2026
7aa035d
feat(doctor): add conflict resolution guidance
papperrollinggery May 1, 2026
ea827c2
test(route): add adaptive routing gate
papperrollinggery May 1, 2026
633e6e1
feat(choices): add preference management endpoints
papperrollinggery May 1, 2026
83f6767
docs(choices): document preference management surfaces
papperrollinggery May 1, 2026
b463765
feat: harden LazyBrain routing and diagnostics
papperrollinggery May 6, 2026
721ad8d
fix: hide provider graph skills by default
papperrollinggery May 6, 2026
b36df42
fix: keep code graph out of HUD
papperrollinggery May 6, 2026
7714865
fix: satisfy public audit for PR docs
papperrollinggery May 6, 2026
78446ac
fix: split fast compile from relation inference
papperrollinggery May 6, 2026
5ee6131
chore: refresh GitNexus context
papperrollinggery May 6, 2026
eba8199
chore: refresh GitNexus index stats
papperrollinggery May 6, 2026
be40500
refactor!: remove unfinished LazyBrain surfaces
papperrollinggery May 7, 2026
9d9831c
fix(status): separate product readiness from hook safety
papperrollinggery May 7, 2026
f89128c
feat(server): expose route and mcp registries
papperrollinggery May 7, 2026
00e5e03
fix(mcp): support claude newline stdio
papperrollinggery May 7, 2026
fdb4917
fix(statusline): hide stale routing noise
papperrollinggery May 7, 2026
314ecfd
fix(statusline): stop routing telemetry noise
papperrollinggery May 7, 2026
0b06d13
fix(statusline): preserve upstream hud fallback
papperrollinggery May 7, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ jobs:
test:
name: Test
runs-on: ubuntu-latest
env:
npm_config_fetch_retries: 5
npm_config_fetch_retry_mintimeout: 20000
npm_config_fetch_retry_maxtimeout: 120000

steps:
- uses: actions/checkout@v4
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ jobs:
npm-release:
name: npm release
runs-on: ubuntu-latest
env:
npm_config_fetch_retries: 5
npm_config_fetch_retry_mintimeout: 20000
npm_config_fetch_retry_maxtimeout: 120000

steps:
- uses: actions/checkout@v4
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
node_modules/
dist/
.lazybrain/
.claude/
*.tsbuildinfo
.env
*.env
Expand Down Expand Up @@ -45,3 +46,6 @@ scripts/check-budget.sh

# Local workflow doc (user-facing, but not for public repo — keep local)
HOW_TO_WORK_WITH_TRAE.md
.gstack/
.gitnexus
.gitnexus.*
141 changes: 6 additions & 135 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,138 +1,9 @@
# Changelog

All notable changes to this project will be documented in this file.
## [v1.5.0]

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

## [v1.5.0] - 2026-04-27

### Added
- Persistent statusline with active (bold) vs dormant (dim) visual distinction, always visible in combined HUD mode.
- Complete UI/UX redesign: unified design system, dark mode support, Chinese-first scrollable single-page layout.
- Chinese admin panel with 6 sections: status overview, live route tester, tool browser, API config editor, system diagnostics, and setup guide.
- Inline API config editing (compile/embedding/secretary LLM settings, API keys, routing engine) with save-to-config.
- `POST /api/config` endpoint to write configuration from the web UI (14 whitelisted keys).
- `GET /api/diagnostics` endpoint returning hook runtime stats, recent events, graph status, and embedding cache health.
- Tiny gate hook now runs lightweight tag-layer matching and injects real results with scores (🟢🟡⚪), tool names, descriptions, and personality roasts.
- Auto language detection (zh/en) for hook-injected routing suggestions.
- Project CLAUDE.md with model-friendly install instructions.

### Changed
- Search API (`/api/search`) now returns all nodes when no query or filter is specified, fixing the empty tools display.
- Lab page redesigned to match the unified design system.

### Fixed
- JavaScript syntax error in setup guide cmd strings due to unescaped newlines in TypeScript template literals.
- Config fields displaying as "未配置" (not configured) due to field name mismatch in renderConfig().
- `autoThreshold` validation now rejects NaN values.
- `POST /api/config` now checks Origin header for defense-in-depth.
- Tiny gate hook now writes `last-match.json` so the statusline shows real match results instead of "建议路由".
- Platform-specific native packages moved to `optionalDependencies` for cross-platform CI compatibility.

## [v1.4.5] - 2026-04-26

### Added
- `RouteSpec` schema version, `no_route_needed` mode, `tokenStrategy`, and route rationale fields for stable cross-surface routing.
- `lazybrain prompt "<query>" --target claude|codex|cursor|generic` with explicit `--copy` clipboard support.
- Read-only MCP stdio server via `lazybrain mcp --stdio`, exposing `lazybrain.route`, `lazybrain.search`, `lazybrain.skill_card`, and `lazybrain.combos`.
- Privacy-preserving route counters through `lazybrain route stats`.
- `lazybrain hook status --json` for runtime diagnostics including skip reason, breaker state, active/hung runs, and p95 duration.

### Changed
- The default Claude hook is now a tiny gate: it performs a fast complexity/vagueness/risk check and injects only a short reminder to call `lazybrain.route`.
- `/api/route` now uses the same history/profile inputs as CLI routing and enforces query/body size limits.
- Public docs now position MCP and prompt output as the main low-intrusion route surfaces, with hook as a reminder gate.

### Security
- MCP tools are read-only, do not execute skills, do not install hooks, do not return agent bodies, and do not read transcripts.
- Hook route telemetry stores only hashes and compact metadata, not raw prompts.

## [v1.4.0] - 2026-04-25

### Added
- Advisory Route Plan orchestrator via `lazybrain route "<query>"`, `--json`, and `--target generic|claude|codex|cursor`.
- Stable `RouteSpec` output with intent, scenario, skills, workflow, context needed, guardrails, verification, done conditions, adapter prompts, warnings, and clarification questions.
- Optional SKILL.md frontmatter schema fields: `useWhen`, `avoidWhen`, `inputs`, `workflow`, `verification`, `doneWhen`, `contextNeeded`, and `guardrails`.
- Built-in combo templates for frontend pages, redesigns, CEO dashboards, public install docs, regression review, stuck-runtime debugging, and public release audit.
- `lazybrain combos [category]` for read-only combo discovery.
- Verification catalog for UI screenshots, dashboard operating questions, docs readability, code checks, hook dry-run, rollback, privacy scan, and package dry-run.
- `POST /api/route` and GUI Try Router Route Plan display.

### Changed
- Route planning stays outside the matcher; `match()` remains retrieval-only while the orchestrator builds execution guidance.
- README and README_CN now document RouteSpec, combo templates, advisory-only behavior, and schema metadata.

### Security
- Route planning does not execute skills, install hooks, read transcripts, return agent bodies, or write Claude/Codex/Cursor configuration.

## [v1.3.0] - 2026-04-25

### Added
- Local Web GUI via `lazybrain ui`, with Overview, Try Router, Skill DB, Hook Safety, Lab, Health, Troubleshooting, and Settings pages.
- Read-only GUI/status APIs: `/`, `/ui`, `/api/status`, `/api/health`, `/api/stats`, `/api/search`, `/api/embeddings/status`, and Lab API aliases.
- Explicit action APIs for `POST /api/test` and `POST /api/embeddings/rebuild` with confirmation gates.
- CLI status homepage as the default `lazybrain` output.
- `lazybrain api test` for compile LLM, secretary LLM, and embedding checks without printing keys.
- `lazybrain embeddings status` and `lazybrain embeddings rebuild --yes` with temp-file atomic cache writes.
- Public audit gate through `npm run audit:public`, PR template, optional Codex review guide, and GitHub release workflow.

### Changed
- `lazybrain --version`, `/health`, `/api/health`, package metadata, and changelog now share one package-version source.
- CI keeps a stable required `Test` check while covering Node 18, 20, and 22, package dry-run, public privacy scan, hook tests, and Lab/server smoke.
- README and README_CN now document GUI usage, API testing, embedding cache rebuild, release gates, and bug recovery.

### Security
- Public audit blocks private paths, local planning docs, personal email markers, token-like secrets, private runtime directory markers, and internal workspace-name leaks.
- Root `AGENTS.md` is no longer tracked in the public repository.
- GUI v1 does not install hooks, read Claude transcripts, return agent body text, or write `.claude/settings.json`.

## [v1.2.0] - 2026-04-25

### Added
- Non-install LazyBrain Lab at `/lab` for visual recommendation testing, agent mapping, team gating, token strategy, and hook readiness.
- Agent inventory scanner for project, user, and plugin agents using metadata only.
- Trusted hook install workflow with dry-run plan, automatic backups, rollback, readiness checks, and global-install confirmation.
- Advisory team model guidance, runtime adapters, and subagent prompt suggestions.

### Changed
- Documentation now recommends scan, offline compile, ready check, Lab preview, hook plan, then project-scoped install.
- Hook docs now separate implemented behavior from planned capabilities and clarify semantic fallback behavior.
- `lazybrain ready` now blocks when hook breaker state, hung records, or host load would make the hook fail closed.
- README and README_CN now include v1.2.0 release positioning, skill/agent metadata coverage, daily usage, and troubleshooting guidance.

### Security
- Redact sensitive config values in CLI output.
- Lab and hook plan responses avoid agent body text, Claude private transcripts, local home paths, and statusline secret parameters.
- Project-scope runtime guard now canonicalizes symlinked workspace paths before comparing cwd.
- Remove internal agent workflow protocol documents from the public repository.

## [v1.1.0] - 2026-04-23

### Added
- Add baseline token cost calculation for accurate token savings in session statistics and dashboard.

## [v1.0.2] - 2026-04-20

### Added
- Project-scoped hook install metadata and workspace `cwd` guard so LazyBrain only runs inside the intended repo by default
- Hook runtime registry, active run inspection, and breaker diagnostics via `lazybrain doctor`, `lazybrain hook ps`, and `lazybrain hook clean`

### Changed
- Hardened hook runtime safety with concurrency limits, hung/stale run handling, overload breaker checks, and fail-closed scope behavior when install metadata is missing
- `doctor --fix` now only repairs LazyBrain-owned state and refuses to silently rebind a missing project scope
- `hook status` and startup diagnostics now surface scope, active hooks, hung hooks, breaker state, and confirm that LazyBrain does not participate in `Stop`
- Documentation updated to reflect the sidecar-agent lifecycle, project-scoped hook behavior, and CLI-first runtime guidance

## [v1.0.0] - 2026-04-19

### Added
- Step 1: Cleanup embedding dead code and fixup decision type identification quality
- Step 2: Decision type identifier for classifying user intents
- Step 3: Team recommender for intelligent agent team formation
- Step 4: Thinking trigger for proactive tool suggestions
- Step 5: Duplicate detector for identifying redundant tools/skills
- Step 6: HTTP API server for desktop UI integration
- Step 7: Real usage data tracking for analytics and improvement
- Kept the verified route, MCP, compile, embeddings, ready, statusline, status, and diagnostics path.
- Replaced the unfinished web console with a compact Workbench for status, diagnostics, route, compile, embeddings, and API tests.
- Removed unfinished choice preference, route adoption, route regression, public jobs, repairs, doctor-fix, and config-test/schema surfaces.
- Removed unpublished planning documents and the bundled Cytoscape asset from the public package.
- Kept RouteSpec `1.5.0` output stable for CLI, HTTP, and MCP consumers.
44 changes: 44 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,3 +81,47 @@ Key routing rules:
- Ship/deploy/PR → invoke /ship or /land-and-deploy
- Save progress → invoke /context-save
- Resume context → invoke /context-restore

<!-- gitnexus:start -->
# GitNexus — Code Intelligence

This project is indexed by GitNexus as **lazy-brain** (3580 symbols, 10213 relationships, 267 execution flows). Use the GitNexus MCP tools to understand code, assess impact, and navigate safely.

> If any GitNexus tool warns the index is stale, run `npx gitnexus analyze` in terminal first.

## Always Do

- **MUST run impact analysis before editing any symbol.** Before modifying a function, class, or method, run `gitnexus_impact({target: "symbolName", direction: "upstream"})` and report the blast radius (direct callers, affected processes, risk level) to the user.
- **MUST run `gitnexus_detect_changes()` before committing** to verify your changes only affect expected symbols and execution flows.
- **MUST warn the user** if impact analysis returns HIGH or CRITICAL risk before proceeding with edits.
- When exploring unfamiliar code, use `gitnexus_query({query: "concept"})` to find execution flows instead of grepping. It returns process-grouped results ranked by relevance.
- When you need full context on a specific symbol — callers, callees, which execution flows it participates in — use `gitnexus_context({name: "symbolName"})`.

## Never Do

- NEVER edit a function, class, or method without first running `gitnexus_impact` on it.
- NEVER ignore HIGH or CRITICAL risk warnings from impact analysis.
- NEVER rename symbols with find-and-replace — use `gitnexus_rename` which understands the call graph.
- NEVER commit changes without running `gitnexus_detect_changes()` to check affected scope.

## Resources

| Resource | Use for |
|----------|---------|
| `gitnexus://repo/lazy-brain/context` | Codebase overview, check index freshness |
| `gitnexus://repo/lazy-brain/clusters` | All functional areas |
| `gitnexus://repo/lazy-brain/processes` | All execution flows |
| `gitnexus://repo/lazy-brain/process/{name}` | Step-by-step execution trace |

## CLI

| Task | Read this skill file |
|------|---------------------|
| Understand architecture / "How does X work?" | `.claude/skills/gitnexus/gitnexus-exploring/SKILL.md` |
| Blast radius / "What breaks if I change X?" | `.claude/skills/gitnexus/gitnexus-impact-analysis/SKILL.md` |
| Trace bugs / "Why is X failing?" | `.claude/skills/gitnexus/gitnexus-debugging/SKILL.md` |
| Rename / extract / split / refactor | `.claude/skills/gitnexus/gitnexus-refactoring/SKILL.md` |
| Tools, resources, schema reference | `.claude/skills/gitnexus/gitnexus-guide/SKILL.md` |
| Index, status, clean, wiki CLI commands | `.claude/skills/gitnexus/gitnexus-cli/SKILL.md` |

<!-- gitnexus:end -->
Loading
Loading