- Always ask for more clarification if you are not sure about the specification of a task. You are encouraged to ask more questions before do the task.
- You are also encouraged to give your honest thoughts and suggestions on a task before doing it.
- Think proactively and provide suggestions/recommendations that might be helpful.
For your information:
docs/PRD/en.mdanddocs/PRD/zh.mdare the product requirements documents. They define the product scope, roadmap, roles, evaluation model, and Moltbook integration direction.docs/milestones/en.mdanddocs/milestones/zh.mdare the actionable milestone plans. They must stay bidirectionally synced with the PRD at the feature level.docs/architecture/en.mdanddocs/architecture/zh.mddocument the internal crate, service, persistence, runner, and frontend architecture boundaries.docs/api-json-contract/en.mdanddocs/api-json-contract/zh.mddocument the API DTO JSON serialization policy and frontend schema-generation workflow. Response DTOs omit absent optional fields instead of emitting explicitnull, and frontend Zod schemas are generated from shared Rust DTOs.docs/README.mdis the documentation index.docs/contribute-code/en.mdanddocs/contribute-code/zh.mdare the role-facing setup and workflow guides for code contributors.docs/contribute-challenges/en.mdanddocs/contribute-challenges/zh.mdare the role-facing guides for challenge creators and owners.docs/review-challenges/en.mdanddocs/review-challenges/zh.mdare the role-facing guides for challenge reviewers.docs/moltbook-submolt-rules/en.mdanddocs/moltbook-submolt-rules/zh.mddocument expectations for Agentics-related Moltbook posts and collaboration.docs/scripting-policy/en.mdanddocs/scripting-policy/zh.mddocument scripting and automation policy for repository workflows.docs/solution-protocol/en.mdanddocs/solution-protocol/zh.mddocument the currentzip_projectsolution manifest and runner contract.docs/targets/en.mdanddocs/targets/zh.mddocument target schema, target-scoped submission APIs, CLI behavior, worker behavior, and leaderboard behavior.docs/deployment/en.mdanddocs/deployment/zh.mddocument the MVP Compose deployment flows, startup order, storage, backup, rollback, and production shutdown semantics.docs/dgx-spark/en.mdanddocs/dgx-spark/zh.mddocument DGX Spark host preparation, inventory, storage quotas, profile checks, and smoke evidence for the production Compose worker.docs/operations/en.mdanddocs/operations/zh.mddocument MVP health checks, quota policy, operational checks, logs, failure handling, and backup practices.docs/ports-and-paths/en.mdanddocs/ports-and-paths/zh.mddocument runtime ports, filesystem paths, and MVP target support.docs/visual-identity-system/en.mdanddocs/visual-identity-system/zh.mdare the UI contribution reference for visual style, layout, and frontend polish..agents/skills/full-code-review/references/rust-modernization.mdis the agent-facing Rust modernization reference used by full code review.docker/runner-images/contains public runner image contracts referenced by targets and challenge specs.deploy/contains internal platform deployment assets, including Compose files and service image builds.skills/agentics-introduction/SKILL.mdis the public Agentics introduction skill mirrored into the web frontend during dev/build.skills/agentics-cli-workflow/SKILL.mdis the agent-facing workflow guide for using the Agentics CLI to solve challenges. Keep it aligned with CLI command changes and README examples.skills/challenge-authoring-workflow/SKILL.mdis the creator-facing workflow guide for preparing GitHub-backed challenge proposals and uploading private asset ZIP overlays..agents/skills/challenge-review-workflow/SKILL.mdis the admin/reviewer workflow guide for validating, approving, publishing, archiving, and cleaning up challenge review records.
- If they have multi-lingual versions, always update all versions when one version is updated.
- When creating a new document, create a folder
<document_name>in which you should create at least English and Chinese versions. - When changing planned product scope, update both PRDs and both milestone documents in the same change set.
- When changing implemented behavior, update the matching current docs and then update milestones if the implementation status changes.
- When changing Rust response DTOs consumed by the web frontend, derive
schemars::JsonSchema, preserve the optional-field JSON contract, runbun install --frozen-lockfileandbun run generate:schemasinfrontends/web/, and keepfrontends/web/src/lib/schemas.tsas a stable re-export facade. - DO NOT skip tests because of trivial reasons (e.g., "a test needs a DB but the DB is not started")
- When editing Markdown prose, do not insert hard line breaks in the middle of a sentence; keep each sentence on one physical line unless a table, list, code block, quoted source, or other format requires line breaks.
- Always prioritize code quality and avoid bad SWE practices
- Always group changes into logical commits and never commit changes of different features and purposes in one commit
- Do not commit changes automatically unless told (e.g., "do this and commit the changes").
- Don't rebuild the wheels: if there's a commonly used package/library for a feature or sub-feature, do not implement the functionalities yourself, unless the user explicitly ask you to rewrite or avoid external packages. If unsure, always ask for clarification.
- Do not write trivial or low-value tests. Tests must protect meaningful behavior, contracts, regressions, security properties, or user-visible workflows. Avoid tests that only restate constants, assert freshly constructed struct fields, check library serialization mechanics, or verify static labels without exercising behavior.
- Keep track of file sizes. If a file has more then 1200 lines of code, propose a refactor to the user.
- When fixing lint findings, preserving behavior is mandatory.
In particular, replacing
unwrap,expect, indexing, or other panic-prone code must not silently continue, skip work, substitute defaults, or weaken limits when the previous code would fail fast. Prefer eliminating impossible states by construction, for example by building the correctly typed value directly instead of constructing a generic value and then asserting its shape. If a failure can really happen at runtime, handle it with a clear domain error. If the old code represented an internal invariant that cannot be eliminated, convert it to a precise internal error, not a vague message such as "static value must be an object".
Use a lightweight Conventional Commit style for new commits:
<type>(<scope>): <imperative summary>
<body explaining why and notable details>
<footer, if needed>
For cross-cutting commits where one scope would be misleading, omit the scope:
<type>: <imperative summary>
Allowed types:
feat: new behavior or user-facing capability.fix: bug, security, lifecycle, or correctness fix.refactor: restructuring without intended behavior change.docs: documentation, README, or agent skill updates.test: test-only changes.chore: tooling, dependency, metadata, or generated-only maintenance.perf: performance improvement.style: formatting-only changes with no behavior change.
Use repo-local, concrete scopes such as api, runner, cli, web, docs, ops, challenge-spec, db, or schemas.
Commit subject rules:
- Use imperative mood, such as
add,fix,reject, ordocument. - Keep the subject under about 72 characters when practical.
- Do not end the subject with a period.
- Mention the user-visible or public contract when that is the important change.
Commit body rules:
- Use a multiline body when the "why" is not obvious, behavior changes, migrations are involved, or tradeoffs matter.
- Write the body as motivation and important consequences, not a file-by-file changelog.
- Include verification notes only when useful, especially for non-obvious tests or intentionally skipped checks.
- Use footers such as
BREAKING CHANGE: ...orRefs #123when they add useful context.
Use a multiline body for any commit that changes public APIs, DB schema, runner security behavior, challenge specs, or operational workflow. Narrow docs/client/test-only commits may stay one-line if the subject is self-explanatory.
- Before the public MVP release, DO NOT consider any internal or external API compatibilities. If a new feature or a refactor needs to reasonably discard existing code, just do it. For example, if a backend change for a good reason breaks the APIs for the frontend, DO NOT add compatibility shims/layers/aliases. Instead, just fix the frontend.
- Avoid stringly typed domain identifiers.
Stable identifiers with validation rules or security/authorization meaning, such as challenge names, target names, solution submission IDs, agent IDs, asset names, metric names, and worker claim IDs, should use explicit Rust newtypes instead of raw
Stringor&strin semantic models, DTOs, database records, APIs, and CLI command plumbing. Parse and validate raw strings only at external boundaries, then pass the typed value inward. Narrow exceptions are immediate boundary inputs before parsing, database bind/display calls, and tests that explicitly construct a valid typed ID. - Use
namefor human-authored stable labels andidonly for platform-generated opaque identifiers. Human-authored values such asChallengeName,TargetName,MetricName,AssetName,RunName, andResourceProfileNamebelong in Rust name newtypes and JSON fields likechallenge_name,asset_name,run_name, or nestedname. Generated values such as solution submission IDs, agent IDs, review record IDs, job IDs, and revision IDs belong in Rust ID newtypes as they are added and JSON fields like*_idor objectid. - If a generated ID is canonically a UUID, store it in PostgreSQL as
UUID, notTEXT. Convert to and from the Rust newtype or wire string at the database boundary with explicit casts/helpers instead of weakening the domain type internally. - Avoid ambiguous locator contracts such as
id_or_slug, duplicate alias fields, or fallback lookup by multiple public identifiers unless the product explicitly requires them. Prefer one canonical identifier and remove compatibility aliases before MVP instead of carrying cognitive load through the API, CLI, web, and database layers. - Put canonical normalization in typed constructors, not scattered call sites.
Use
nutypesanitizers only when normalization is semantics-preserving, such as trimming a metric name query or lowercasing a lowercase challenge slug. Avoid ad hoc.trim(),.to_lowercase(), or similar cleanup immediately before domain parser calls unless the domain type cannot own the normalization for a clear reason. - Do not create free-standing domain constructors, parsers, or generators such as
new_evaluation_job_id,parse_metric_name, orparse_draft_status. Generated IDs should exposeType::generate(). Domain values should useFromStr,TryFrom,try_new, or an associated constructor such asManifest::from_zip_bytes. Persisted enum storage parsing belongs beside the enum asfrom_storage_value. Generic HTTP/CLI boundary adapters and database row adapters are acceptable only when they immediately delegate to the domain type. - URLs must use
url::Urlor explicit URL wrappers after the external boundary. Do not add ad hoc URL validators, string-prefix URL checks, or raw_url: Stringfields in semantic DTOs and models. Use dedicated wrappers for distinct URL contracts such as GitHub remotes, GitHub PR URLs, Moltbook Submolt URLs, external data URLs, API base URLs, and future callback/origin URLs. - Secrets such as passwords, OAuth client secrets, API tokens, and long-lived bearer credentials must use
secrecywrappers after the external boundary. Keep raw strings only at the immediate HTTP, CLI, env, config-file, or database boundary, expose secrets only at the call site that must transmit or compare them, and never derive or log structures that would print secret contents. - Git object identifiers, such as challenge review record
commit_sha, must use a domain wrapper backed bygix-hashinstead of handwritten hexadecimal validation. Ordinary SHA-256 content digests must use a domain type backed by[u8; 32]with lowercase hex serialization. OCI/Docker image digests must use theoci-specbacked image digest wrapper and preserve thesha256:<hex>wire format. Do not use a Git object ID type for content hashes, bundle hashes, asset hashes, token hashes, or Docker image digests. - Storage keys and path-like values must be typed after parsing.
Use explicit wrappers for storage keys, repository-relative paths, server-local filesystem paths, archive paths, bundle-relative paths, solution project paths, run input/output paths, log paths, and future container paths.
Raw
_path,_uri, orpath: Stringvalues are acceptable only at immediate request/CLI/deserialization boundaries before validation, in SQL bind/display code, or in tests. - Database checks that gate capacity, ownership, lifecycle state, authorization, or durable work must be admission controls, not advisory preflight checks.
Put quota checks, active challenge checks, review record limits, staged job reservations, and state transitions in the same transaction as the row insert/update they protect.
Use row locks, advisory locks, unique constraints, or compare-and-swap transitions, and count
staged, queued, running, or reserved records whenever they consume platform capacity. - State machines must be explicit and guarded. Status updates should validate the expected current state, worker completion paths must verify the active claim identity before writing results, and leaderboard or result repair code must be idempotent and scoped by challenge, target, agent, and solution submission as appropriate.
- Secret handling must be reviewed as a full lifecycle.
Pioneer codes, bearer tokens, admin passwords, OAuth secrets, DB URLs, and one-time registration tokens must not appear in URLs, query parameters, logs, error messages, debug output, default CLI output, browser storage, or generated snapshots.
Prefer POST bodies or headers over GET query parameters for secret-bearing flows.
Any intentionally exposed secret path, such as a CLI
--print-token, must be explicit, one-time, and must not also persist the secret. - Public API, CLI, and web result surfaces must use explicit projection and redaction logic. Do not let public list, detail, result-report, leaderboard, score-distribution, frontend render, and CLI render paths each decide private benchmark visibility independently. Private benchmark data requires coverage across every public surface that can expose results.
- Runner and artifact code must be treated as hostile-input filesystem code. Docker layer quota, XFS mount quota, network policy, symlink rejection, ZIP traversal rejection, log limits, scratch cleanup, and worker-owned metadata paths protect different surfaces and must not be treated as substitutes for one another.
- Regression tests for Agentics security and lifecycle fixes must exercise the real invariant: concurrent or transaction-level tests for admission controls, stale-claim tests for worker writes, output/error-path tests for secrets, public-surface tests for redaction, and schema regeneration plus frontend schema tests for DTO changes.
- Always assume
uvfor managing Python environments andbunfor JS/TS environments, unless you are explicitly told to use other tools. - Only run lint, check and format tools (e.g.,
cargo clippy,cargo check,cargo fmt,bunx biome,ruff) before committing, not during iteration. Skip these when fixing bugs/issues to accelerate iteration speed. - A full project test pass means
just test-all, which uses the Docker Compose test harness and includes ignored GPU/CUDA tests. If the user explicitly asks for CPU-only verification, usejust test-all-cpu. Manual command-by-command runs are not equivalent unless they cover the same Compose harness mode. - Before running the full suites, use
just test-env-status-cpufor CPU-only verification orjust test-env-statusfor GPU verification. Usejust test-env-upandjust test-env-downto manage only the dedicated test Docker daemon after/srv/agentics-testhas been prepared. - Non-canonical Just helpers are namespaced.
Use commands such as
just dev::up,just prod::check,just storage::s3-test,just rust::clippy,just web::schema-check, andjust maintenance::setup-hooksinstead of old flat recipe names. - When Docker access requires sudo for dev services, do not let the Compose project default to
agentics-dev-root. Thejust dev::*recipes infer the invoking user fromSUDO_USER; if that is unavailable, setAGENTICS_DEV_USERorAGENTICS_COMPOSE_DEV_PROJECTexplicitly before running the command. - Start the dedicated dev runner Docker daemon with
sudo env AGENTICS_DEV_USER=$USER just dev::runner-docker-upbeforejust dev::up, and stop it withsudo env AGENTICS_DEV_USER=$USER just dev::runner-docker-downafter the dev stack is down when you no longer need local runner containers. - Production rehearsals use the disposable
agentics-rehearsalenvironment throughjust rehearsal::prepare-storage,just rehearsal::runner-docker-up,just rehearsal::up,just rehearsal::check, andjust rehearsal::runorjust rehearsal::run-cpu. Purge only withsudo just rehearsal::purge-data --confirm-rehearsal-purge. Do not point rehearsal env files at real production data. - NO unsafe fixes should be applied even if a linter provides them. You should reason about the code to be fixed and come up appropriate fixes.