This file is for coding agents working in this repository. Read it before making code changes.
execgo is an agent-first execution kernel and action harness.
Core responsibilities:
- Accept task DAGs over HTTP, and optionally gRPC when built with the
grpcbuild tag. - Validate and schedule tasks with dependency ordering, retries, timeouts, and bounded concurrency.
- Execute tasks through the V2 executor model: category + tool.
- Persist task state to disk through the default JSON file store.
The repository is not just a demo. The main execution path is real and tested.
Design bias:
- Build for AI agent workloads first.
- Keep the core runtime disciplined and modular.
- Do not drift into a generic workflow engine unless the user explicitly wants that tradeoff.
Important directories:
cmd/execgo: binary entrypoint, runtime wiring, graceful shutdown, optional gRPC startup.pkg/models: core task and API response models.pkg/httpserver: HTTP routing and handlers.pkg/scheduler: DAG scheduling, retries, timeout handling, dependency propagation.pkg/executor: executor registry and built-in executors.pkg/store: storage interfaces.pkg/store/jsonfile: default persistent store implementation.pkg/observability: structured logging, trace ID middleware, metrics counters.tests/unit: small isolated tests.tests/module: scheduler-level behavioral tests.tests/integration: HTTP and MCP flow tests.contrib/*: optional modules such as gRPC API server, SQLite store, Redis cache wrapper.
The executor system is in the V2 category-tool shape.
Built-in categories:
osmcpcli-skills
Built-in os tools currently include:
shellfilednstcpsleepnoophttp
Compatibility note:
- Legacy task types like
shellandhttpare normalized into theoscategory bypkg/executor/normalize.go. - Do not remove that compatibility path unless the whole API contract is intentionally being changed.
Before changing behavior, read these files first:
README.mdcmd/execgo/main.gopkg/models/task.gopkg/httpserver/engine.gopkg/scheduler/scheduler.gopkg/executor/executor.gopkg/executor/normalize.go
If touching tests or runtime wiring, also read:
tests/testutil/runtime.go
If touching gRPC, also read:
cmd/execgo/grpc_start.gocmd/execgo/grpc_start_stub.gocontrib/grpcapi/pkg/grpcserver/server.go
- Preserve the core module's lightweight design. Avoid adding unnecessary third-party dependencies to the root module.
- Keep optional integrations isolated under
contrib/*when they are not essential to the core execution kernel. - Prefer extending existing abstractions over bypassing them.
- When changing task execution behavior, keep
HTTP -> scheduler -> executor -> storeflow coherent. - If you change task fields or API contracts, update tests and relevant docs in
README.mdanddocs/. - Do not silently break legacy task type compatibility.
- Do not revert unrelated user changes in the worktree.
Run the full suite after meaningful changes:
go test ./...In sandboxed environments, Go's default build cache may be blocked. Use local cache directories when needed:
mkdir -p .cache/go-build .cache/gomod
GOCACHE=$(pwd)/.cache/go-build GOMODCACHE=$(pwd)/.cache/gomod go test ./...Notes:
tests/integrationstarts a local HTTP test server and may need permission in restricted sandboxes.- Scheduler or executor changes should be verified beyond unit tests. Run module and integration tests if behavior changes.
- gRPC startup is optional and guarded by build tags.
- The normal build path uses
cmd/execgo/grpc_start_stub.go. - Do not assume gRPC is always enabled in the default binary.
- The default runtime store is
pkg/store/jsonfile. - It periodically persists to
state.jsonunder the configured data directory. - On recovery, tasks left in
runningare reset topending.
Any change to persistence semantics should be treated as a compatibility-sensitive change.
For HTTP API changes:
- Update handlers in
pkg/httpserver. - Check model compatibility in
pkg/models. - Verify scheduler/store interaction.
- Add or update integration tests.
For scheduler changes:
- Read current dependency and retry behavior in
pkg/scheduler/scheduler.go. - Preserve skip propagation semantics for downstream tasks.
- Add or update module tests in
tests/module. - Re-run full tests.
For executor changes:
- Update the registry or built-ins in
pkg/executor. - Preserve normalization behavior unless intentionally changing contracts.
- Add focused unit tests and at least one higher-level behavioral test if externally visible.
This repository may contain local-only directories and generated artifacts during development, for example:
.idea/.cache/- local state files under
data/
Do not include incidental local artifacts in commits unless the user explicitly asks for that.
Before committing, inspect git status and stage only the files relevant to the current task.
- Use short conventional-style commit messages when possible.
- Keep commits scoped to one behavioral change or one fix.
- If a change affects public behavior, mention the affected subsystem in the commit prefix, such as
fix(scheduler): ...orfeat(executor): ....
- Prefer a small, localized fix over a broad refactor.
- Prefer preserving existing behavior over speculative cleanup.
- If behavior is ambiguous, check tests first, then README and docs, then adjust code.