Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
22 changes: 22 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
## Summary

<!-- The smallest view that makes the change clear: a file-tree diff, call tree,
or pseudocode. Use the terms in GLOSSARY.md. -->

## Evidence

<!-- Before and after. Offline: validate_skill.py, unittest, agentskills validate.
Live: runner cases with date and result (pass / mismatch / inconclusive).
Docs: which official pages were reread. -->

- **Before:**
**After:**

## Merge Danger

**Door:** <!-- one-way or two-way -->

**Blast Radius:** <!-- e.g. docs-only, consumers, runner, CI -->

<!-- Never include keys, key names, account details, local paths,
private inputs, generated media or raw responses. -->
75 changes: 40 additions & 35 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -1,45 +1,50 @@
# ecnu-api repository guide

## Purpose

This is an Agent Skills package, not a production application.
Optimize for less repeated setup, lookup, and troubleshooting work.
These instructions apply to maintaining this repository, not consuming apps.

## File routing

- `SKILL.md`: small integration entry point and task routing.
- `references/api_reference.md`: official endpoint links, not copied field tables.
- `references/models.md`: selection defaults and current account-source pointers.
- `references/examples.md`: ECNU-specific integration recipes.
- `references/workbuddy_setup.md`: WorkBuddy desktop custom-model configuration recipe.
- `references/workflows.md`: symptom-driven, opt-in diagnostics.
- `references/known_deviations.md`: dated live evidence; preserve dates and scope.
- `references/agent_development.md`: historical guidance cited by old observations.
- `scripts/` and `tests/`: existing diagnostics and offline validation.
- `docs/skill-refactor-plan.md`: refactor scope and acceptance evidence.

## Editing rules

- Prefer current official contracts; keep observed differences separately dated.
- Add content only when it saves a concrete lookup, decision, mistake, or repeated action.
- Keep everyday integration separate from platform audits and repository maintenance.
- Do not invent API limits or copy upstream model defaults into ECNU requests.
- Do not refresh a test date or label a snippet live-verified without a real test.
- Update installed copies via `npx skills update -g ecnu-api`, not manual copying.
This Agent Skill repository's rules are for maintainers, not consuming projects.

## What belongs in the skill

The official ECNU docs are the contract. Keep only what they do not provide:
task routing, production practice, small recipes, and current live deviations.
Link to official values instead of copying them; the one exception is the dated
model snapshot in `references/models.md`. Do not keep history: Git has it.

## Files

- `SKILL.md`: entry point, connection example, single routing table.
- `references/examples.md`: ECNU-specific recipes; each code block has an offline test.
- `references/engineering.md`: concurrency, retries, timeouts, cost, errors.
- `references/audit.md`: read-only checklist for existing integrations; each check cites evidence.
- `references/models.md`: dated model snapshot and account pages.
- `references/troubleshooting.md`: symptom table, live deviations, runner usage.
- `scripts/smoke_test.py`: live runner; `scripts/validate_skill.py` and `tests/`: offline checks.

## Rules

- Every observed row names a runner case; add the case first, and change its
date only after rerunning it. Never invent limits or copy upstream defaults.
- A sentence about what the docs say links the page it comes from. After an
ECNU release, reread every linked page (not just the release notes) and check
those sentences and the runner's expectation strings; then run `--profile all`,
update the snapshot, delete rows whose case passes, and redate the rest.
- Update installed copies via `npx skills update -g ecnu-api`, not by copying.

## Validation

Manage Python with `uv`; do not assume `python3` is on PATH (e.g. on Windows).

```bash
python3 scripts/validate_skill.py
python3 -m unittest discover -s tests -v
python3 -m compileall scripts tests
uv run --no-project python scripts/validate_skill.py
uv run --no-project --with requests --with httpx --with openai --with anthropic python -m unittest discover -s tests -v
uv run --no-project python -m compileall scripts tests
uvx --from skills-ref agentskills validate "$PWD"
git diff --check
```

Report unavailable checks as not run. Review tracked changes for secrets.
Live checks use only `ECNU_API_KEY`, serial requests, no ambiguous POST retry,
and an approved cumulative budget. Never commit private inputs, reasoning,
credentials, generated media, one-time URLs, or raw responses. Keep sanitized
live artifacts under the ignored `.live-artifacts/` directory.
Report unavailable checks as not run. Live checks read only `ECNU_API_KEY`, run
serially and never retry an ambiguous POST. Maintainer live tests of this
repository are pre-authorized with no credit ceiling; pass a large explicit
`--max-credits` (the runner requires a finite value). This does not change the
skill's 50-credit default for consuming apps. Keep sanitized reports under the
ignored `.live-artifacts/`; never commit keys, private inputs, reasoning,
generated media, one-time URLs or raw responses.
23 changes: 23 additions & 0 deletions GLOSSARY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Glossary

Terms used across the skill, its maintenance rules and pull requests.

| Term | Meaning |
|---|---|
| **Contract** | What the current official ECNU documentation states. The skill links to it rather than copying it. |
| **Documented** | Supported by a linked official page. Evidence column value: `docs`. |
| **Observed** | Seen on the live service on a stated date, reproducible with a runner case. |
| **Deviation** | An observed behavior that differs from the contract; a row in `references/troubleshooting.md`. |
| **Runner** | `scripts/smoke_test.py`: serial, budgeted, redacting live checks. |
| **Runner case** | One named check in the runner (for example `effort_only_ecnu_plus`); every observed row names one. |
| **Profile** | A group of runner cases: `auth`, `core`, `compatibility`, `billable`, `all`. |
| **Revalidation** | After an ECNU release: reread every linked page, run `--profile all`, delete rows whose case passes, redate the rest. |
| **Snapshot** | The dated model table in `references/models.md`, the only copied official values. |
| **Recipe** | A small ECNU-specific code example in `references/examples.md`, each covered by an offline test. |
| **Routing table** | The single task → official page → local help table in `SKILL.md`. |
| **Audit** | The read-only check of an existing integration in `references/audit.md`. |
| **Primary model** | `ecnu-plus` or `ecnu-max`. Older names such as `ecnu-reasoner` are **aliases**. |
| **Effort tier** | A `reasoning_effort` value; valid tiers differ per primary model. |
| **Credits** | ECNU's billing unit; personal tokens share a rolling 7-day pool. |
| **Peak hours** | The weekday daytime window when token prices double. |
| **Side-effect-free call** | A request safe to resend (embedding, rerank, decision); chat, image and TTS are not. |
69 changes: 27 additions & 42 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,65 +1,50 @@
# ECNU API Agent Skill

An unofficial skill that helps an Agent connect to the ECNU / ChatECNU LLM
Open Platform without repeatedly finding the same docs or rediscovering the
same integration differences.

The default path is small: a working connection example, task-specific official
documentation, and a few ECNU-specific recipes. Full live diagnostics are opt-in.
This is not another API manual, a generic Agent course, or a required test harness.
An unofficial Agent skill for building on the ECNU / ChatECNU LLM Open
Platform: connect an application or SDK, harden it for production, and
diagnose failures without rediscovering the same differences each time.

## Install and use

```bash
npx skills add JJasonSun/ecnu-api
```

Update an existing global installation:

```bash
npx skills update -g ecnu-api
```

Example request:

```text
Use $ecnu-api to adapt this application to ECNU. Keep the current framework.
Only change the integration and its relevant checks; do not make live requests.
```

For an existing global installation:

```bash
npx skills update -g ecnu-api
```
Configure `ECNU_API_KEY` through the environment or a secret manager when
execution is needed. Never paste a real key into chat or commit it.

Configure `ECNU_API_KEY` through the local environment or secret manager when
execution is needed. Never paste a real key into chat or commit it. Missing
credentials should not prevent the Agent from writing or reviewing code.
## What this adds to the official docs

## Where to go
The [official documentation](https://developer.ecnu.edu.cn/vitepress/llm/model.html)
is the contract and changes often, so the skill links to it instead of copying
it, and keeps only what the docs do not give an Agent:

| Need | Resource |
| Need | Where |
|---|---|
| Start a normal integration | [SKILL.md](SKILL.md) |
| Find the relevant official endpoint contract | [Endpoint map](references/api_reference.md) |
| Image edits, multimodal retrieval, LangChain embeddings, thinking/tool history, Anthropic SDK | [Integration recipes](references/examples.md) |
| WorkBuddy desktop custom-model setup | [WorkBuddy recipe](references/workbuddy_setup.md) |
| Model choice or current account facts | [Model/account pointers](references/models.md) |
| Diagnose a failure or select a live probe | [Targeted diagnosis](references/workflows.md) |
| Inspect dated evidence | [Known deviations](references/known_deviations.md) |
| Maintain this repository | [AGENTS.md](AGENTS.md) |
| Inspect the refactor's acceptance evidence | [Acceptance record](docs/skill-refactor-plan.md) |

The older [Agent-development notes](references/agent_development.md) remain to
preserve historical prompt-fixture references in the observation log. They are
not part of the default integration reading path or a current model benchmark.

## Validation and evidence

The existing runner and unit tests are retained. Maintainer commands are in
`AGENTS.md`; they are not steps for an Agent editing someone else's application.
Live checks require appropriate authorization and a cumulative credit budget.
A documentation edit is not a new live test: observation dates and statuses must
not be refreshed without reproducing the relevant behavior.

Use current official pages for changing contracts, models, prices, and quotas.
Use local recipes to save integration work and dated observations to diagnose
specific discrepancies. Do not assume compatibility with every upstream feature.
| Which protocol, model and official page fit a task | [SKILL.md](SKILL.md) |
| Small ECNU-specific recipes, each covered by an offline test | [Recipes](references/examples.md) |
| Concurrency, retries, timeouts, cost and error handling in production | [Engineering](references/engineering.md) |
| Read-only audit or migration of an existing integration | [Audit](references/audit.md) |
| Current model snapshot and account pages | [Models](references/models.md) |
| Symptoms, current live deviations, and how to rerun them | [Troubleshooting](references/troubleshooting.md) |

Every live observation names a runner case in `scripts/smoke_test.py`, so it
can be reproduced or retired after an ECNU release. History lives in Git:
observations that no longer reproduce are deleted, not archived. Maintainer
rules are in [AGENTS.md](AGENTS.md).

## Disclaimer

Expand Down
Loading
Loading