Skip to content

Design a foxctl feature

Status: Current guide.

foxctl features usually cross several layers: CLI, skill runtime, storage, context, retrieval, agents, or UI. The safe design path is to choose the owner family first, keep the first slice narrow, and document which surfaces are current versus planned.

Write the first sentence as a user action:

As an agent or operator, I need to ...

Then decide the smallest public surface:

User needFirst surface
Repeatable task with JSON input/outputSkill
Long-running or stateful local behaviorCLI command plus storage
Agent coordinationAgent or room command
Retrieval or graph navigationRepoindex, semantic search, or context engine
External service callProvider, MCP, or OpenAPI adapter
Dashboard workflowAPI plus GUI only after the CLI path is clear

Avoid adding a runtime abstraction before a command or proof path exists.

Use the package topology map before adding or moving code.

ConcernPackage family
Domain value typesinternal/domain
Wire contracts and envelopesinternal/protocol
Config, workspace, clocks, shared platform utilitiesinternal/platform
Durable state, CAS, local DBs, projectionsinternal/storage
Context, memory, transcript continuityinternal/context/*
Repo graph, semantic search, codemaps, retrievalinternal/intelligence/*
Skill execution, jobs, hooks, daemon hostinginternal/runtime/*
Web, gateway, chat, OpenAPI surfacesinternal/interfaces/*
Newer agent/runtime/orchestration lane onlyinternal/v2/*

internal/v2 is not a general destination for new context, retrieval, storage, or interface code.

Prefer this order:

  1. Document the behavior and status label.
  2. Add a small pure core or storage shape.
  3. Add a CLI or skill proof.
  4. Add tests and golden outputs.
  5. Add agent, hook, room, or GUI surfaces only after the command path works.

For experimental dependencies, add a gate first. The LadybugDB planning posture is the model: external projection first, no dual-write, no core Go dependency until the proof succeeds.

Strong foxctl features usually define:

ContractQuestion to answer
Input schemaWhat does the caller provide?
Output envelopeWhat stable data can scripts consume?
Source of truthWhich store or source owns canonical state?
Derived artifactsWhat can be rebuilt or deleted safely?
Failure modeWhat does fallback look like?
ObservabilityWhich event, report, or artifact proves what happened?
VerificationWhich command proves the feature works?

If the output can exceed the inline threshold, design the CAS path before shipping the command.

For retrieval and context features, decide which plane owns each job:

PlaneOwns
Semantic searchMeaning-based candidate discovery
RepoindexGraph-shaped source relationships and explanation subgraphs
ACAWorkspace continuity, vault notes, proposal lanes, and retrieval policy
Context engineTyped evidence packs, lane fusion, retrieval episodes, and feedback
App codeRanking policy, query planning, permissions, and LLM summarization

Keep ranking and policy explicit. Do not route behavior through ad hoc keyword matching.

Every new feature doc should say one of:

  • Current
  • Experimental
  • Planned
  • Archive

If a plan has not shipped, keep it in docs/plans/ and link it as planned context. Do not present it as production behavior.

Before calling a feature production-ready:

  • CLI or skill path works from a clean checkout.
  • Tests cover the behavior contract.
  • Generated output is deterministic or stored as a CAS artifact.
  • Markdown links pass.
  • Security-sensitive dependency changes were vetted before install.
  • Agent-facing docs mention fallback and boundaries.