agentleFS
mclucymclucy/lucy/operation/AGENTS.md

lucy / operation

AGENTS.md58 starsChanged 8 days agoApache-2.0View on GitHub

operation orchestrates workspace lifecycle commands (Create, Initialize, Sync, Add, Downgrade, Remove, Upgrade, Deinitialize, RenameServer, SetJava).

The file

Files
AGENTS.md

Package operation

operation orchestrates workspace lifecycle commands (Create, Initialize, Sync, Add, Downgrade, Remove, Upgrade, Deinitialize, RenameServer, SetJava).

Responsibilities & Boundaries

  • Coordinates multi-step workspace workflows across install.Service, routing Source, serverregistry.Registry, and document models.
  • Prepares documents, evaluates server runtime environments, and coordinates upgrade Pareto frontiers without owning low-level file transactions.

Invariants & Behavior

  • Explicit Dependency Injection: Service never accesses global singletons. Dependencies (install.Service, Source, serverregistry.Registry, log.Logger) must be passed explicitly into NewService.
  • Workspace Locking & Recovery: Mutating operations serialize through the workspace writer lock (workspacewrite.Lock on .lucy/writer.lock) and run journal recovery (filetrack.RecoverLocked) before applying mutations. Read-heavy workflows (e.g. PlanUpgrade preflight or target inspection) may inspect documents or paths prior to acquiring the lock.
  • Retention Leases & Registry: Candidate-resolving workflows (Create, Initialize, PlanUpgrade, Downgrade) acquire an artifact store lease (artifactstore.AcquireOperation) to shield staged files from retention sweeps. Workspaces are recorded in serverregistry.Registry only after their lock is visible; initialization registers after its manifest/lock/receipt transaction commits and before the operation lease closes, because the registry reads the manifest and the sweep must never trace a workspace whose documents were never published.
  • Document Pinning: Workflows capture manifest and lock fingerprints (pinWorkspaceDocuments) before passing options to install.Service, rejecting concurrent external workspace edits.
  • Downgrade Selection: Downgrade requires a current lock and freezes its server and MCDReforged runtime. Requested direct roots move to older package labels; each chosen build is its project's only candidate. --force accepts package conflicts, not runtime violations or overwrites. Locked and offline modes are rejected before workspace acquisition. Selection and resolution failures publish nothing; application retains normal transaction and post-commit provisioning semantics.
  • Phased Error Recovery: Distinct phase errors (CreateResolveError, CreatePublishError, CreateRegistrationError, CreateInstallError) distinguish pre-publish aborts from post-publish installation failures where declared files remain intact for retry.

Targeted Tests

  • Workspace initialization & selection: go test ./operation -run TestInitializeWritesDeclarationForVanillaLayout
  • File tracking and runtime pins: go test ./operation -run TestFileCommandsPreserveRuntimePinsAndReceipt
  • Server rename safety: go test ./operation -run TestRenameServerChangesOnlyManifestName
  • Upgrade planning & Pareto selection: go test ./operation -run 'Test(ParetoFrontierDropsDominatedOptions|SelectUpgradeOption|UpgradePlanHashIsOrderIndependent)'

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.