Files
Jack Chen fed84334ed docs(agents): trim the root AGENTS.md and add a core package file (#591)
Align the agent instruction files with the current CLAUDE.md guidance: keep only what a session cannot derive from the tree, and load package-specific rules on demand.

- Replace the workspace table and the docs table with pointers to `ls packages/` and docs/README.md, which already indexes every page.
- Split the dependency-pinning rule into rule and rationale, and reflow the run-store invariant onto one line.
- Move the architecture entry points, the examples lint exclusion, and the adapter checklist into packages/core/AGENTS.md, with a CLAUDE.md shim that imports it.
2026-09-08 11:24:47 +08:00

2.7 KiB

@open-multi-agent/core agent rules

Repository-wide rules, the validation matrix, and the cross-package invariants are in the root AGENTS.md. This file holds only what matters while editing this package. Paths below are relative to packages/core/ unless they start with ../.

Architecture entry points

src/ is organized one directory per subsystem; run ls src/ to locate code rather than relying on any list of those directories, and use docs/ for behavior and contracts. Inside src/orchestrator/, orchestrator.ts is the entry point that the peer modules in that directory hang off.

The published surface is src/index.ts plus the subpath entry points declared under exports in package.json; list them with jq '.exports | keys' packages/core/package.json from the repository root rather than relying on any copy of that list. When adding or renaming one, keep that declaration, the backing source file, and the required entry-point list in the package job of .github/workflows/ci.yml in sync.

OpenMultiAgent exposes three primary modes: runAgent() for a one-shot agent, runTeam() for coordinator-generated task DAGs, and runTasks() for explicit dependency pipelines. See the README for the conceptual architecture.

Lint type-checks the examples

npm run lint -w @open-multi-agent/core type-checks examples/ alongside src/ via tsconfig.lint.json. That config excludes examples/fixtures/ and the self-contained example projects that carry their own package.json/tsconfig.json. Add a new example of that shape to its exclude list, since lint cannot resolve a package-name import of @open-multi-agent/core before dist exists.

Adding an LLM adapter

  1. Implement LLMAdapter.chat() and LLMAdapter.stream(), add the provider to SupportedProvider, and register it in src/llm/adapter.ts through dynamic import() so unused SDKs never resolve. OpenAI-compatible providers should accept baseURL and reuse openai-common.ts.
  2. Decide how the provider behaves under egressPolicy in prepareProviderBaseURL. An OpenAI-compatible provider needs an entry in PROVIDER_DEFAULT_BASE_URLS or a provider endpoint environment variable so its origin can be resolved and checked. A provider whose SDK opens connections OMA cannot guard must be declared unsupported so it fails closed.
  3. Add the outcome to the enforcement matrix in docs/egress-policy.md.
  4. Add focused adapter tests and update docs/providers.md without introducing a hard-coded provider count.