Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
143 commits
Select commit Hold shift + click to select a range
0ee0bb3
Doc: Add design for upgrading context management in nexent with 16 wo…
JasonW404 Jun 11, 2026
7dc2d61
docs: complete context management production review
JasonW404 Jun 15, 2026
89a1c55
Merge branch 'doc/context-management-upgrade' into feature/model-capa…
wuyuanfr Jun 15, 2026
baca5f4
Merge commit 7dc2d616: docs: complete context management production r…
wuyuanfr Jun 15, 2026
e77e175
feat(W1): add type skeleton for ModelCapacityResolver and tokenizer r…
wuyuanfr Jun 15, 2026
d19937f
Merge pull request #1 from liudfgoo/feature/w1-capacity-skeleton
wuyuanfr Jun 15, 2026
2c4cb7c
feat(W1): add capacity columns to model_record_t (additive migration)
wuyuanfr Jun 15, 2026
39b9be0
docs: move W1 ADR to dedicated ADRs directory
wuyuanfr Jun 15, 2026
690ca7d
Merge pull request #2 from liudfgoo/feature/w1-capacity-db-migration
wuyuanfr Jun 15, 2026
2943b27
feat(W1): implement resolve_capacity with catalog + operator override
wuyuanfr Jun 15, 2026
1ef4823
Merge pull request #3 from liudfgoo/feature/w1-capacity-resolver-impl
wuyuanfr Jun 15, 2026
a121d52
feat(W1 step 4): extend SDK ModelConfig with capacity fields, rename …
wuyuanfr Jun 15, 2026
6c41e97
feat(W1 step 6): wire ModelCapacityResolver in create_agent_info, dro…
wuyuanfr Jun 15, 2026
c8e9582
feat(loop-engineering): add comprehensive insight report on Loop Engi…
JasonW404 Jun 15, 2026
fce7753
Merge branch 'doc/context-management-upgrade' of github.com:liudfgoo/…
JasonW404 Jun 15, 2026
cd29819
docs: add W1 ADR to ADRs directory
wuyuanfr Jun 15, 2026
a1cd921
feat(W1 step 8): emit capacity snapshot fields in monitoring
wuyuanfr Jun 15, 2026
eb47502
feat(W1 step 3): surface provider-discovery capacity hints as candidates
wuyuanfr Jun 15, 2026
c3c9553
feat(W1 step 7): expose capacity fields in Add/Edit Model forms
wuyuanfr Jun 15, 2026
4723a70
docs: review 5 findings (CM-017, CM-018, CM-021, CM-024, CM-025)
JasonW404 Jun 15, 2026
2c2615b
docs: accept CM-026 decision — exclude unsupported modalities from Re…
JasonW404 Jun 15, 2026
6d5d444
docs: retire W7, merge checkpoints into W5 as compression.snapshot ev…
JasonW404 Jun 15, 2026
76c1f7b
fix(W1): clarify optional capacity fields
wuyuanfr Jun 15, 2026
0100203
docs: accept CM-009 decision — defer workload envelopes until post-im…
JasonW404 Jun 15, 2026
7b2d931
docs: accept CM-010 decision — defer numeric targets until post-imple…
JasonW404 Jun 15, 2026
ea819c7
docs: accept CM-015 decision — remove content hashing, use O(1) metad…
JasonW404 Jun 15, 2026
88d849d
fix(web): bind production server to all interfaces
wuyuanfr Jun 15, 2026
e6298a1
docs: accept CM-022 decision — consolidate decision traces into unifi…
JasonW404 Jun 15, 2026
d6671cd
fix(W1 step 7): expose capacity fields in ProviderConfigEditDialog
wuyuanfr Jun 16, 2026
2dfefbb
test: stabilize test_model_provider_service against dual-import sys.m…
wuyuanfr Jun 16, 2026
a889c97
docs(W1): record post-acceptance known limitations and open W17 for c…
wuyuanfr Jun 16, 2026
eab510b
docs: update W3 with dispatch path analysis and bypass elimination plan
JasonW404 Jun 16, 2026
c71ddc3
docs(W17): integrate post-acceptance workstream into both production …
wuyuanfr Jun 16, 2026
6e33826
fix(W1 step 7): unify max_tokens with capacity panel and migrate lega…
wuyuanfr Jun 16, 2026
98ccd4c
fix(W1 step 7): Add panel description gone; tokenizer shares row; Edi…
wuyuanfr Jun 16, 2026
01a2b0f
docs: clarify W4 step 4 and step 6 implementation details
JasonW404 Jun 16, 2026
55c32f6
fix(W1 step 7): required = context_window + max_output; drop Collapse…
wuyuanfr Jun 16, 2026
7a049eb
docs: refine W5 implementation plan with sub-steps and clarifications
JasonW404 Jun 16, 2026
172a7ef
docs(W17): close three self-review gaps before implementation
wuyuanfr Jun 16, 2026
2b6994e
docs(W2 review): formalize six-item checklist from W1 retrospective; …
wuyuanfr Jun 16, 2026
dafe5d8
docs(review): convert W2 post-acceptance review to CM-NNN format unde…
wuyuanfr Jun 16, 2026
32d3bab
docs: refine W6 with projection priority, ContextItem scope, and impl…
JasonW404 Jun 16, 2026
e883a1d
Merge origin/doc/context-management-upgrade — 9 review decisions + W7…
wuyuanfr Jun 16, 2026
a7981b5
docs: update W8 to align with CM-015 decision (remove content hashing)
JasonW404 Jun 16, 2026
deaa800
docs: unify finding namespace (KL-* → CM-*), close 9 review decisions…
wuyuanfr Jun 16, 2026
7992ad7
docs: update W9 with terminology fixes, resolve_ambiguous_effect, and…
JasonW404 Jun 16, 2026
00a444e
Merge remote-tracking branch 'upstream/develop' into sync/develop-int…
wuyuanfr Jun 16, 2026
d7aa0fb
docs: refine W10 with deprecation notice, subagent policy independenc…
JasonW404 Jun 16, 2026
af49bbb
docs: refine W11 with subagent reducer independence and step 3 clarif…
JasonW404 Jun 16, 2026
c995ea7
Merge pull request #4 from liudfgoo/sync/develop-into-doc-upgrade
wuyuanfr Jun 16, 2026
bcdcfc8
docs: refine W12 with offload threshold clarification, subagent artif…
JasonW404 Jun 16, 2026
c1a0772
docs: update W13 with current state gap analysis and implementation r…
JasonW404 Jun 16, 2026
45e6404
docs: refine W14 with deprecation notice, subagent governance, and pe…
JasonW404 Jun 16, 2026
777d718
docs: clarify W15 step 1 baseline timing and performance coordination
JasonW404 Jun 16, 2026
830d7e4
docs: add W16 subagent cache optimization and performance baseline pr…
JasonW404 Jun 16, 2026
9ebb61c
docs: renumber W-IDs to match new development sequence
JasonW404 Jun 16, 2026
f422041
docs: update production plan with new W-ID order and phase structure
JasonW404 Jun 16, 2026
e5957f9
docs: fix all W-ID anchor links in production plan
JasonW404 Jun 16, 2026
4249ea6
W1: Correct Model Token-Capacity Configuration + post-acceptance find…
wuyuanfr Jun 16, 2026
8f2daef
docs: revise W17 capacity suggestion spec
wuyuanfr Jun 16, 2026
6681b0d
docs: rewrite Chinese production plan with new W-ID numbering
JasonW404 Jun 16, 2026
c95dee3
docs(W2): add ADR for budget snapshot overrides and dispatch enforcement
wuyuanfr Jun 16, 2026
ab23fbe
docs(W2): absorb CM-027-CM-030 findings into spec and production plan
wuyuanfr Jun 16, 2026
328b068
Add W2 capacity budget skeleton
wuyuanfr Jun 16, 2026
0c5a5d6
docs: remove retired W7 strikethrough row from Chinese production pla…
JasonW404 Jun 16, 2026
2231949
Merge branch 'doc/context-management-upgrade' of github.com:liudfgoo/…
JasonW404 Jun 16, 2026
a38dd48
Add W2 reserve policy configuration
wuyuanfr Jun 17, 2026
06a9c03
Implement W2 safe input budget calculator
wuyuanfr Jun 17, 2026
9ab9b6b
docs: add Chinese translations for all W-ID specification documents (…
JasonW404 Jun 17, 2026
c9a2b18
Resolve W2 request safe input budget
wuyuanfr Jun 17, 2026
07bdb3b
Apply W2 safe budgets to context manager
wuyuanfr Jun 17, 2026
59ef19c
Enforce W2 output tokens at dispatch
wuyuanfr Jun 17, 2026
bb0b682
Emit W2 budget snapshots to monitoring
wuyuanfr Jun 17, 2026
805ccf2
Surface W2 uncertainty reserve warning
wuyuanfr Jun 17, 2026
9c76b32
Verify W2 budget fingerprint at dispatch
wuyuanfr Jun 17, 2026
dbd768e
Verify W1 capacity identity at W2 dispatch
wuyuanfr Jun 17, 2026
95fce7b
Backfill W2 capacity from W1 catalog for legacy deployments
wuyuanfr Jun 17, 2026
b6dd7f2
docs: add codebase gap analysis, reorder priorities, mark deferred wo…
JasonW404 Jun 17, 2026
9f246b8
Make missing-capacity warning operator-friendly and dedup it
wuyuanfr Jun 17, 2026
95b4eee
docs(W17): add visibility surfaces for existing bare-capacity models
wuyuanfr Jun 17, 2026
1c62ff6
docs: renumber W-IDs by priority, rename deferred to P-IDs
JasonW404 Jun 17, 2026
6c2d0f7
Fix soft-delete column name in W2 catalog backfill migration
wuyuanfr Jun 17, 2026
4ccd506
docs(W17): add bare-row production evidence and scope to LLM/VLM only
wuyuanfr Jun 17, 2026
689e3ec
Raise legacy fallback threshold to 81920 and explain output reserve i…
wuyuanfr Jun 17, 2026
0816816
Retune legacy capacity fallback from 81920 to 32768
wuyuanfr Jun 17, 2026
811f31e
docs: add capacity values explainer covering W1/W2/W3 number flow
wuyuanfr Jun 17, 2026
09bc4c6
Enforce output reserve ceiling at the agent-edit form
wuyuanfr Jun 17, 2026
d95fe16
Reject max_input_tokens > context_window_tokens on both ends
wuyuanfr Jun 17, 2026
099116f
Raise SDK requested_output_tokens fallback from 1024 to 4096
wuyuanfr Jun 17, 2026
06c5de4
docs: refresh Capacity Values Explainer after UX gap fixes
wuyuanfr Jun 17, 2026
1d73917
Render defaultOutputReserveTokens in both Add and Edit modes
wuyuanfr Jun 17, 2026
612a705
docs: sync W1 and W2 ADRs with post-acceptance W2 implementation
wuyuanfr Jun 17, 2026
b2df5f4
docs: 更新上下文管理文档并同步中文翻译
Jun 17, 2026
3991ebd
Fix W2 dispatch failure on legacy max_tokens divergence
wuyuanfr Jun 17, 2026
3dd69bb
Merge origin/doc/context-management-upgrade into W2 branch
wuyuanfr Jun 18, 2026
a9edef4
feat(W2): model capacity catalog, safe input budget, and dispatch enf…
wuyuanfr Jun 18, 2026
d38baa3
docs: record W11 capacity suggestion decisions
wuyuanfr Jun 18, 2026
bfb4bba
Wire capacity fields through the batch-add path for LLM/VLM models
wuyuanfr Jun 18, 2026
72c9e22
docs: accept W11 catalog save semantics
wuyuanfr Jun 18, 2026
4f770de
Surface batch defaults in row gear modal; gate Add on per-row capacity
wuyuanfr Jun 18, 2026
741492b
Honor new W2 capacity default in batch fetch hooks' max_tokens fallback
wuyuanfr Jun 18, 2026
18a2f20
Stop reading legacy max_tokens as a stand-in for max_output_tokens
wuyuanfr Jun 22, 2026
5985d4b
Stop reading legacy max_tokens in the single-model add path
wuyuanfr Jun 22, 2026
60655ef
Apply the add-side validation and legacy hygiene to the edit dialogs
wuyuanfr Jun 22, 2026
75d0c13
docs: 增加手动压缩入口和压缩消息展示,优化配置解析与持久化方案
Jun 22, 2026
c303094
Merge remote-tracking branch 'origin/develop' into doc/context-manage…
Jun 22, 2026
6dd7351
Wire per-row capacity gate and drop legacy max_tokens leak from provi…
wuyuanfr Jun 22, 2026
8bbd607
Persist W2 capacity through batch_create and add bulk-apply panel to …
wuyuanfr Jun 22, 2026
70d231b
Honor operator-vs-candidate contract on batch_create W2 persistence, …
wuyuanfr Jun 22, 2026
67a75f0
Stop ModelDeleteDialog from silently dropping gear-save edits and for…
wuyuanfr Jun 22, 2026
7cdabec
Extend spec review checklist with W1/W2 follow-up retrospective lesso…
wuyuanfr Jun 22, 2026
7463ac0
Merge remote-tracking branch 'origin/doc/context-management-upgrade' …
wuyuanfr Jun 22, 2026
8f9287b
Stabilize W1/W2 model capacity handling and document W11 follow-ups (…
wuyuanfr Jun 22, 2026
d301b55
docs: finalize W11 capacity suggestion spec
wuyuanfr Jun 22, 2026
bd1c282
docs: clarify W11 rollout scope
wuyuanfr Jun 22, 2026
bc391ab
feat: add W11 catalog capacity suggestion service
wuyuanfr Jun 22, 2026
5d4c87b
feat: expose W11 capacity suggestion API
wuyuanfr Jun 22, 2026
2e2d8a7
feat: add W11 capacity coverage API
wuyuanfr Jun 22, 2026
3e48abe
feat: add W11 frontend capacity suggestion
wuyuanfr Jun 22, 2026
1abcb6b
feat: show W11 capacity coverage warnings
wuyuanfr Jun 22, 2026
39fa6e5
fix(w11): wrap suggest-capacity and capacity-coverage in shared envelope
wuyuanfr Jun 23, 2026
d2b5fab
fix: use add_repo_to_name in merge_existing_model_attributes lookup key
wuyuanfr Jun 23, 2026
70d6427
feat(w11): emit counter when capacity-coverage catalog matcher fails
wuyuanfr Jun 23, 2026
c460f11
test(w11): pin {message, data} envelope on suggest-capacity and coverage
wuyuanfr Jun 23, 2026
f724464
test: stub real add_repo_to_name in model_provider_service test setup
wuyuanfr Jun 23, 2026
8ccd330
feat: broaden capability catalog matcher reach
wuyuanfr Jun 23, 2026
be802bf
fix(w11): keep user-selected provider untouched by capacity suggestion
wuyuanfr Jun 23, 2026
3580785
fix(w11): prompt before reusing legacy max_tokens instead of silent fill
wuyuanfr Jun 23, 2026
459b12b
docs: align Capacity_Values_Explainer with shipped W11 reserve UI
wuyuanfr Jun 23, 2026
46f0ffa
Merge remote-tracking branch 'origin/doc/context-management-upgrade' …
wuyuanfr Jun 23, 2026
af5a1e3
feat(W11): V1, capacity suggestion API, frontend UX, catalog coverage…
wuyuanfr Jun 23, 2026
1899172
chore: exclude working docs from PR
wuyuanfr Jun 23, 2026
fdbf948
Merge remote-tracking branch 'upstream/develop' into pr/context-manag…
wuyuanfr Jun 23, 2026
1055165
test: update create_agent_info stubs for capacity modules
wuyuanfr Jun 23, 2026
63f5213
fix(w11): hide tokenizer_family input from all four model capacity su…
wuyuanfr Jun 24, 2026
16c947c
feat(w11): make context_window/max_output optional with save-time def…
wuyuanfr Jun 24, 2026
8213154
test: fix stale assertions after W1/W2 merge from upstream/develop
wuyuanfr Jun 24, 2026
e9eb48e
test: align test_get_creating_sub_agent_info_impl_success with W2 res…
wuyuanfr Jun 24, 2026
db81cdc
test: restore missing mock setup in test_import_agent_by_agent_id_pub…
wuyuanfr Jun 24, 2026
72e378e
fix(create_agent_info): correct param indentation and guard warning d…
wuyuanfr Jun 24, 2026
10a41ca
fix: tighten capacity suggestion error handling
wuyuanfr Jun 24, 2026
f88eead
fix: remove stale deepseek capacity backfill
wuyuanfr Jun 24, 2026
611ae4a
chore: consolidate capacity migration sql
wuyuanfr Jun 24, 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
128 changes: 127 additions & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<!-- SKILLS_TABLE_START -->
<usage>
When users ask you to perform tasks, check if any of the available skills below can help complete the task more effectively. Skills provide specialized capabilities and domain knowledge.
When users ask to perform tasks, check if any of the available skills below can help complete the task more effectively. Skills provide specialized capabilities and domain knowledge.

How to use skills:
- Invoke: `npx openskills read <skill-name>` (run in your shell)
Expand Down Expand Up @@ -40,3 +40,129 @@ Usage notes:
<!-- SKILLS_TABLE_END -->

</skills_system>

---

## Project Overview

Nexent is a zero-code platform for auto-generating AI agents. Monorepo with:
- `backend/` - FastAPI HTTP API
- `sdk/nexent/` - Core agent framework (pip package)
- `frontend/` - Next.js web UI
- `docker/` & `k8s/` - Deployment configs

---

## Developer Commands

### Backend (Python 3.10)

```bash
# Setup
cd backend && uv sync --extra data-process --extra test

# Install SDK for development
cd backend && uv pip install -e "../sdk[dev]"
```

### Run Tests

```bash
# From project root, with backend venv activated
source backend/.venv/bin/activate && python test/run_all_test.py

# Single test file
pytest test/backend/apps/test_agent_app.py -v
```

### Frontend (Next.js)

```bash
cd frontend
npm run dev # Development server
npm run check-all # type-check + lint + format + build
```

### Docker Deployment

```bash
cd docker
cp .env.example .env # Fill required configs
bash deploy.sh # Interactive deployment
```

---

## Architecture

### Environment Variables

**Single source of truth**: `backend/consts/const.py`

- NO direct `os.getenv()` / `os.environ.get()` outside this file
- SDK (`sdk/nexent/`) NEVER reads env vars - accepts config via parameters
- Services read from `consts.const` and pass to SDK

### Backend Layer Structure

| Layer | Path | Responsibility |
|-------|------|----------------|
| Apps | `backend/apps/` | HTTP boundary: parse input, call services, map exceptions to HTTP |
| Services | `backend/services/` | Business logic orchestration, raise domain exceptions |
| Consts | `backend/consts/` | Env vars (`const.py`), exceptions (`exceptions.py`), error codes |

**Exception flow**: Services raise domain exceptions → Apps map to HTTP status codes

---

## Database Migrations

**Location**: `docker/sql/*.sql` (versioned migration scripts)

**Critical rule**: When adding columns/tables via migration script:
- Update `docker/init.sql` (Docker Compose fresh deploy)
- Update `k8s/helm/nexent/charts/nexent-common/files/init.sql` (K8s fresh deploy)

**Version**: Tracked in `backend/consts/const.py` as `APP_VERSION`

---

## Testing Conventions

- pytest only (no unittest)
- Mock at import site with fully-qualified path:
```python
mocker.patch("backend.services.agent_service.AgentService.run", return_value={...})
```
- Async tests: `@pytest.mark.asyncio`
- Test structure: `test/backend/` and `test/sdk/`

---

## Code Style

- English-only comments and docstrings (enforced by `.cursor/rules/english_comments.mdc`)
- Import order: stdlib → third-party → project
- Line length: 119 (sdk ruff config)

---

## Key Files

| File | Purpose |
|------|---------|
| `backend/consts/const.py` | All env var definitions, APP_VERSION |
| `backend/consts/exceptions.py` | Domain exceptions (AgentRunException, LimitExceededError, etc.) |
| `docker/init.sql` | Database schema for Docker Compose |
| `k8s/helm/.../init.sql` | Database schema for Kubernetes |
| `test/run_all_test.py` | Test runner with coverage |

---

## Reference Files

Existing instruction files with detailed rules:
- `CLAUDE.md` - Backend architecture, env var management, app/service layer rules
- `.cursor/rules/environment_variable.mdc` - Env var centralization
- `.cursor/rules/pytest_unit_test_rules.mdc` - Testing patterns
- `.cursor/rules/english_comments.mdc` - Comment language enforcement
Loading
Loading