Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
122 commits
Select commit Hold shift + click to select a range
605bb69
feat(agent-core-v2): add visual model assignment for image inspection
Aug 9, 2026
ac20aec
Merge branch 'main' into feat/visual-model-assignment
zikzak-ai Aug 13, 2026
123d890
Merge pull request #1 from zikzak-ai/feat/visual-model-assignment
zikzak-ai Aug 13, 2026
3d77373
merge: upstream/main into development (conflicts resolved)
arrrrny Aug 18, 2026
b8a7fd7
ci: add daily upstream sync workflow
arrrrny Aug 18, 2026
3f47ec6
fix(ci): add upstream remote before fetch
arrrrny Aug 18, 2026
9f07696
auto-sync 2026-08-18
arrrrny Aug 18, 2026
706e0bf
fix: remove stale secondaryModelOverlay import, add stripEnvBoundFiel…
arrrrny Aug 18, 2026
f27c0b4
fix: remove duplicate secondaryModel registration
arrrrny Aug 18, 2026
f450b55
feat: add /visual-model slash command for image inspection model sele…
arrrrny Aug 18, 2026
92f4abd
Merge remote-tracking branch 'upstream/main' into development
arrrrny Aug 18, 2026
a3e3d4f
ci: add fork native release workflow
arrrrny Aug 18, 2026
83893c2
fix(ci): fix YAML in fork release workflow notes
arrrrny Aug 18, 2026
fa2f39b
ci: slim fork release to darwin-x64 and linux-x64 only
arrrrny Aug 18, 2026
b2264ff
fix: add missing aliases to /visual-model slash command registration
arrrrny Aug 18, 2026
f9c4151
merge: sync upstream 2026-08-19
github-actions[bot] Aug 19, 2026
0f2ecb0
merge: sync upstream 2026-08-20
github-actions[bot] Aug 20, 2026
ee53e07
feat: add proxy URL per provider and multiple API keys support
arrrrny Aug 20, 2026
b26db9f
merge: sync upstream 2026-08-20 (conflicts resolved)
github-actions[bot] Aug 20, 2026
abf5f3b
chore: change sync schedule to 3 AM UTC
arrrrny Aug 21, 2026
05ee2bf
merge: sync upstream 2026-08-21
github-actions[bot] Aug 21, 2026
a5947bf
ci: reschedule fork native release cron to 03:10 UTC
arrrrny Aug 21, 2026
87cb389
chore: gitignore local caches and scratch dirs
arrrrny Aug 21, 2026
617f7a8
merge: sync upstream 2026-08-22
github-actions[bot] Aug 22, 2026
00fb7ed
merge: sync upstream 2026-08-23
github-actions[bot] Aug 23, 2026
ab12c9b
feat: add /update-all-session-models command (#2)
arrrrny Aug 23, 2026
b6c42b0
feat(agent-core-v2): add dedicated compaction model with fallback (#1)
arrrrny Aug 23, 2026
15b67ad
feat: auto-compact threshold configurable per session (#3)
arrrrny Aug 23, 2026
cefb120
fix(tui): surface the compaction model (slash command + started indic…
arrrrny Aug 23, 2026
be78307
feat(tui): model favorites with quick rotation (#5)
arrrrny Aug 23, 2026
20fb5e8
fix(tui): compaction model selection was ignored at compaction time
arrrrny Aug 23, 2026
837c4f8
Merge pull request #6 from arrrrny/fix/compaction-model-ignored
arrrrny Aug 23, 2026
f2ed42d
fix(tui): update-all-session-models crash, silent no-op, and missing …
arrrrny Aug 23, 2026
a91a39b
Merge pull request #7 from arrrrny/fix/update-all-session-models-broken
arrrrny Aug 23, 2026
53583c1
feat(tui): rename /compaction-model to /squeeze-model + secondary squ…
arrrrny Aug 23, 2026
0d1f1b8
Merge pull request #8 from arrrrny/feat/squeeze-model-rename-and-seco…
arrrrny Aug 23, 2026
90bb843
merge: sync upstream 2026-08-24
github-actions[bot] Aug 24, 2026
3e4a53e
fix(goal): pause and auto-resume goals around auto compaction (#10)
arrrrny Aug 24, 2026
a07a7ad
fix(agent-core-v2): pause context injection during compaction (#11)
arrrrny Aug 24, 2026
4c94a7c
fix: apply CodeRabbit auto-fixes (#12)
coderabbitai[bot] Aug 25, 2026
29a0ebf
ci: retarget fork workflows to master (drop main/development)
arrrrny Aug 25, 2026
7b01e05
chore: restore local spec-kit skill/extension and bug-assessment work
arrrrny Aug 25, 2026
fcd3fd9
ci: deploy docs from master instead of main
arrrrny Aug 25, 2026
60ccf5a
revert: remove auto-compact changes conflicting with upstream
arrrrny Aug 26, 2026
19af63f
merge: sync upstream 2026-08-26
arrrrny Aug 26, 2026
de534b1
merge: sync upstream 2026-08-26
github-actions[bot] Aug 26, 2026
900b974
fix: pause the agent loop during auto compaction instead of cancellin…
arrrrny Aug 26, 2026
962f21f
merge: sync upstream 2026-08-26
github-actions[bot] Aug 26, 2026
b1c6481
fix: restore the compaction model fallback cascade and surface retry …
arrrrny Aug 26, 2026
4813fc0
fix: replace Alt+M/Alt+S with Shift+A/R/S in model chooser (#21)
arrrrny Aug 26, 2026
e78e0df
merge: sync upstream 2026-08-27
github-actions[bot] Aug 27, 2026
09ee8ff
Merge branch 'MoonshotAI:main' into master
arrrrny Aug 27, 2026
079c83d
feat: add private profile specification (#24)
arrrrny Aug 27, 2026
1f58bf2
Merge branch 'MoonshotAI:main' into master
arrrrny Aug 27, 2026
d5c1303
fix: apply CodeRabbit auto-fixes (#25)
coderabbitai[bot] Aug 27, 2026
3a49b08
feat: activate the substitute model on provider rate limits (#23)
arrrrny Aug 27, 2026
a217fb0
Merge branch 'MoonshotAI:main' into master
arrrrny Aug 27, 2026
15d5db3
merge: sync upstream 2026-08-28
github-actions[bot] Aug 28, 2026
ae80b20
Merge branch 'MoonshotAI:main' into master
arrrrny Aug 28, 2026
aa7c684
merge: sync upstream 2026-08-29
github-actions[bot] Aug 29, 2026
837af6f
merge: sync upstream 2026-08-30 (conflicts resolved)
github-actions[bot] Aug 30, 2026
34888d8
fix: honor bash_task_timeout_s for background Bash tasks (#26)
arrrrny Aug 30, 2026
f667103
Merge branch 'MoonshotAI:main' into master
arrrrny Aug 30, 2026
6d686fa
feat(agent-core-v2): add [subscription] config to disable credit-cons…
arrrrny Aug 30, 2026
9f996de
fix(oauth): refresh OpenAI-compatible providers from their /models en…
arrrrny Aug 30, 2026
bc2e03b
chore(speckit): disable automatic worktree creation
arrrrny Aug 30, 2026
064b972
merge: sync upstream 2026-08-31
github-actions[bot] Aug 31, 2026
726659d
Merge branch 'MoonshotAI:main' into master
arrrrny Aug 31, 2026
d4a20ce
fix: honor provider context length from OpenAI-compatible /models (#32)
arrrrny Aug 31, 2026
183a82b
fix: add on-demand /refresh-catalog and stop clobbering curated context
arrrrny Aug 31, 2026
8a263b9
feat: wire /refresh-catalog slash command into the TUI
arrrrny Aug 31, 2026
ee4b672
Merge branch 'MoonshotAI:main' into master
arrrrny Aug 31, 2026
088e31b
fix(tui): show the compaction model name in the running indicator
arrrrny Aug 31, 2026
ad9f2b3
docs(agents): record mandatory fork upstream sync policy
arrrrny Aug 31, 2026
90f5b03
feat: add per-provider free_models_only setting for OpenAI-compatible…
arrrrny Aug 31, 2026
6506915
Merge branch 'MoonshotAI:main' into master
arrrrny Aug 31, 2026
67d1eac
fix: add free_models_only to v2 engine provider schema (#37)
arrrrny Aug 31, 2026
695c8a2
Merge branch 'MoonshotAI:main' into master
arrrrny Aug 31, 2026
ec02e94
Merge branch 'MoonshotAI:main' into master
arrrrny Aug 31, 2026
2084f01
spec: add fallback-model cascade feature specification (#009)
arrrrny Sep 1, 2026
358cd8b
spec: add session-specific model picker feature specification (#009)
arrrrny Sep 1, 2026
9503e06
spec: add fuck-permissions mode feature specification (#008)
arrrrny Sep 1, 2026
2e9e85c
Merge pull request #39 from arrrrny/827-fallback-model-cascade
arrrrny Sep 1, 2026
f2bb073
Merge pull request #40 from arrrrny/829-session-model-picker
arrrrny Sep 1, 2026
0a0b4d0
Merge pull request #41 from arrrrny/830-fuck-permissions
arrrrny Sep 1, 2026
9fc0e4d
feat(fallback-model): per-provider fallback model cascade (#42)
arrrrny Sep 1, 2026
ce4b492
fix(agent-core-v2): address PR #38 CI failures (lint + typecheck) (#43)
arrrrny Sep 1, 2026
ed04b93
feat(kimi-code): add /fork-session alias and /fork-and-switch command…
arrrrny Sep 1, 2026
e6d0d55
Merge upstream/main into master
arrrrny Sep 1, 2026
4c8f609
Merge origin/master (reconcile with concurrent fork PRs after upstrea…
arrrrny Sep 1, 2026
76e5c75
fix(lockfile): restore agent-base@9.0.0 + ahooks@3.9.7 declarations
arrrrny Sep 1, 2026
f44c27b
fix(nix): remove unresolved conflict markers from flake.nix
arrrrny Sep 1, 2026
d3c9cff
fix(nix): update pnpmDeps hash to match current lockfile
arrrrny Sep 1, 2026
3772f5c
merge: sync upstream 2026-09-02
github-actions[bot] Sep 2, 2026
7358a6c
Merge upstream/main (8 commits) into master
arrrrny Sep 2, 2026
a1bcae7
Merge origin/master (reconcile after daily sync workflow)
arrrrny Sep 2, 2026
cd154ab
fix(ci): rewrite sync-upstream.yml to comply with fork-upstream-sync …
arrrrny Sep 2, 2026
7191e9e
fix(nix): update pnpmDeps hash for the upstream-merge lockfile
arrrrny Sep 2, 2026
9d48707
fix(bash): honor bash_task_timeout_s when the model omits per-call ti…
arrrrny Sep 2, 2026
3ab7b7e
docs(changeset): add entry for bash_task_timeout_s omit-default fix
arrrrny Sep 2, 2026
5b69471
test(bash): add production-smoke test for bash_task_timeout_s flow
arrrrny Sep 2, 2026
a6ca04c
feat(tui): add /compact-threshold-k slash command for absolute token-…
arrrrny Sep 2, 2026
9aab889
fix(oauth): use models.dev catalog context when /models endpoint omit…
arrrrny Sep 2, 2026
0bf1a76
fix(agent-core-v2,kap-server,transcript,oauth): address pre-existing …
arrrrny Sep 2, 2026
d4c1da4
fix(agent-core-v2,kap-server,transcript,oauth): address pre-existing …
arrrrny Sep 2, 2026
71aa9e8
Merge pull request #44 from arrrrny/fix/bash-task-timeout-ignored
arrrrny Sep 2, 2026
26290ac
fix(openai): remove duplicate close-paren from merged convertOpenAIEr…
arrrrny Sep 2, 2026
1df1432
test(compact-threshold-k): close A2/A9/A13 acceptance gaps + U11 tele…
arrrrny Sep 2, 2026
a3f5eec
merge: sync upstream/main 18 commits (2026-09-03) into fork
arrrrny Sep 3, 2026
4d2fdb7
Merge pull request #49 from arrrrny/chore/sync-upstream-2026-09-03
arrrrny Sep 3, 2026
1bc7681
Merge branch 'MoonshotAI:main' into master
arrrrny Sep 3, 2026
b0b0219
fix(oauth): correct catalog enrichment priority and bump default cont…
arrrrny Sep 3, 2026
52589e7
feat(agent-core-v2,klient,node-sdk,kimi-code): add session-level mode…
arrrrny Sep 3, 2026
e378a56
fix: tighten SessionModelOverrideKind type across contract/RPC/SDK la…
arrrrny Sep 3, 2026
4670d78
Merge pull request #50 from arrrrny/fix/model-picker-shift-s-missing
arrrrny Sep 3, 2026
9090fb9
fix(tui): clear todo panel on goal completion to prevent stale in_pro…
arrrrny Sep 3, 2026
7a7e30c
Merge pull request #51 from arrrrny/fix/todo-list-completion-display
arrrrny Sep 3, 2026
06ef233
fix(agent-core): send x-opencode-session header on outbound LLM requests
arrrrny Sep 4, 2026
2185de3
Merge pull request #53 from arrrrny/fix/x-opencode-session-header
arrrrny Sep 4, 2026
0d335e1
merge: sync upstream/main 17 commits (2026-09-04) into fork
arrrrny Sep 4, 2026
40b9b99
Merge pull request #54 from arrrrny/sync/fork-sync-resolution-2026-09-04
arrrrny Sep 4, 2026
935798c
merge: sync upstream/main 19 commits (2026-09-05) into fork
arrrrny Sep 5, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
70 changes: 70 additions & 0 deletions .agents/skills/agent-core-dev/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
---
name: agent-core-dev
description: Use when developing in packages/agent-core-v2 (the DI × Scope agent engine) — adding or modifying a domain Service, choosing a LifecycleScope, wiring DI dependencies, splitting a domain across scopes, owning or migrating a config section, gating behavior behind an experimental flag, raising coded errors, working on the permission system, writing DI/Scope tests, porting business logic from agent-core (v1) to v2, triaging a main-branch commit against v2, or exposing a v2 domain over server-v2 while keeping the /api/v1 wire contract compatible with released clients. Self-contained guide organized by development stage (orient → design → implement → test → verify) plus align workflows for v1→v2 migration, main-branch commit triage, and server-v2 wire exposure; each file carries the rules, examples, and red lines for its step.
---

# agent-core-dev

> Develop `packages/agent-core-v2` by lifecycle stage. This skill is **self-contained**: every rule, recipe, and red line lives in the stage files below — it does not delegate to `packages/agent-core-v2/docs/`.

`agent-core-v2` is the new agent engine built on the **DI × Scope** architecture (a port of `packages/agent-core`). Everything resolves through the container: a service declares an **identity**, its **dependencies**, and a **lifetime**; the container decides construction, singleton-per-scope, ordering, and disposal. The stage files restate the rules in imperative form so you can work without reading the source docs.

## Lifecycle at a glance

```text
Orient → Design → Implement → Test → Verify
│ │ │ │ │
│ │ │ │ └─ lint:imports · typecheck · test · dep graph · red lines
│ │ │ └─ test.md
│ │ └─ implement.md (+ errors.md · flags.md · permission.md)
│ └─ design.md
└─ orient.md
```

Stages are ordered but not strictly linear: a test failure (stage 4) that reveals a wrong scope sends you back to design (stage 2); a `CyclicDependencyError` sends you to `design.md` §dependency-direction and `implement.md` §cycles.

## Workflows

End-to-end procedures that span the stages. Reach for these before reading the stage files individually.

- [Align (port `agent-core` → `agent-core-v2`)](align.md): split a v1 class into semantic units, fix each unit's domain / scope / Service / dependencies, then migrate the logic and tests. Use when the task is "move feature X from v1 to v2" or "port `IXxxService` to v2".
- [Commit align (triage a `main` commit against v2)](commit-align.md): given one `main` commit hash + a short note, find the v1 logic it changed, check whether v2 already has the corresponding implementation, bucket it (aligned / partial / missing / not-applicable), and recommend a minimal fix. Use in the `kimi-code-v2`-catching-up-to-`main` phase, for one commit at a time; escalate to [align.md](align.md) if the gap is a whole domain.
- [Server align (expose `agent-core-v2` over `server-v2`)](server-align.md): wire a v2 domain into `packages/kap-server` over `/api/v2` (native) and `/api/v1` (v1-compatible mirror), keep the wire schema byte-compatible with the established v1 contract by sharing the `@moonshot-ai/protocol` schema, and isolate v1-only behavior in a `<domain>Legacy` edge adapter instead of distorting the native v2 Service. Use when the task is "expose the new v2 Service on the server", "add a route to the `/api/v1` surface", or "keep server-v2 wire-compatible with released v1 clients".

## Stages

- [Stage 1 — Orient](orient.md): the DI black box (identity / dependencies / lifetime), the four `LifecycleScope` tiers and visibility, and the no-comment convention. Read before touching business code.
- [Stage 2 — Design a service](design.md): pick a scope, split a domain across scopes, choose a calling style (direct call vs event vs hook), and direct dependencies. Decide *where things live and who knows whom* before coding.
- Topic: [Domain boundaries vs Scope](domain-boundaries.md) — keep `session` / `agent` / `turn` from becoming god objects; data-ownership test and their split conclusions.
- Topic: [Persistence layering](persistence.md) — the three-layer `Store → Storage → backend` model, naming Stores by access pattern, and which layer business code should depend on.
- Topic: [Edge exposure — `resource:action` + WS events](edge-exposure.md) — which Services are exposed over `/api/v2` (per-scope action map) and which events stream over WS; what to wrap in a facade.
- [Stage 3 — Implement](implement.md): the standard Service recipe and the DI building blocks — interface + identity, constructor injection, scoped registration, `Disposable`, eager vs delayed, `invokeFunction`, `createInstance`, child scopes, and the cycle-refactor playbook.
- Topic: [Service authoring](service-authoring.md) — file layout, naming, contract vs impl contents, interface style, constructor/field conventions, events, multi-Service domains, comment rules.
- Topic: [Config](config.md) — the section-registry model, App vs Session split, owning a config section, the TOML format, and the env overlay.
- Topic: [Errors](errors.md) — co-located `XxxError`, the central code registry, wire serialization, boundary translation.
- Topic: [Flags](flags.md) — `registerFlagDefinition`, `IFlagService.enabled(id)`, the `[experimental]` config section, resolution precedence.
- Topic: [Permission](permission.md) — risk-only chain-of-responsibility kernel, harness constraints and product reviews as domain `onBeforeExecuteTool` veto listeners (`veto` / `allow` / `pass` / cold `waitUntil` factories), shared `toolApproval` round-trip, policy registry + composer, `modes`/`agentTypes` metadata, `resolveExecution`/`accesses`.
- Topic: [Telemetry](telemetry.md) — emitting events via `ITelemetryService`, context propagation, and appender destinations (`ConsoleAppender` / `CloudAppender`).
- [Stage 4 — Test](test.md): resolve the system under test by interface, pick `TestInstantiationService` vs `createScopedTestHost`, shared stubs, service groups, teardown.
- [Stage 5 — Verify & submit](verify.md): `lint:imports`, `typecheck`, `test`, and the pre-submit checklist.

## How to use this skill

Jump to the stage you are in and read that one file; each is self-contained and ends with its own red lines. Skim the global red lines below before submitting — they catch most mistakes across every stage. The repo's source of truth remains the code in `packages/agent-core-v2/src/`; this skill codifies the same rules so you do not have to re-derive them.

## Global red lines

Invariants that hold across every stage. Each is expanded in the stage file noted.

1. No `new` on a class whose constructor carries `@IService` deps — inject with `@IX` or `accessor.get(IX)`. (implement.md)
2. `@IX` decorates constructor parameters only; parameter order depends on construction (static-first for `createInstance`, `@IX`-first for scoped services). (service-authoring.md)
3. Both interface and impl carry `_serviceBrand`; the `createDecorator` name is globally unique. (implement.md)
4. Parent scope never depends on child scope — short-lived may inject long-lived, never the reverse. (orient.md)
5. No cyclic dependencies — refactor (extract a third Service / use an event / re-scope); activation timing does not break dependency cycles. (design.md, implement.md)
6. `ServicesAccessor` is valid only during `invokeFunction` — never stash it for async use. (implement.md)
7. Scope follows state identity — no `Map<sessionId, …>` at `App` to fake per-session state. (design.md)
8. Foundational layers never know upstream ones; business code never depends on the edge layer (`gateway`/`rpc`). (design.md)
9. Throw coded errors; register codes centrally; branch on `code` across the wire, never `instanceof`. (errors.md)
10. Gate unreleased behavior behind a flag contributed via `registerFlagDefinition` and resolved through `IFlagService.enabled(id)`; no ad-hoc env toggles. (flags.md)
11. Tests resolve the SUT by interface; shared stubs live under `test/`, never `src/`. (test.md)
12. Config is the preference registry: only preferences that are persistable, schema'd, and user/operator-facing go in `IConfigService`. Domain-specific config (including env-only operational toggles) goes through `registerConfigSection` + `envOverlay`. Facts → `IBootstrapService`, and host invocation arguments (CLI flags, host identity headers, prompt identity) → `BootstrapInput.args` / `IBootstrapService.args` — never new per-domain runtime-options services; domain runtime state (cron/flags/model) never goes onto `IBootstrapService`; session state → Session scope; constants → code. Business domains never call `IBootstrapService.getEnv()` directly. (config.md)
Loading