Sugar commands combine multiple operations into single calls -- the recommended way to start and end agent work sessions.
begin -- Start Everything
$ pd begin "Building auth system"
Agent registered: agent-a1b2c3
Session started: sess-d4e5f6
Context saved to .portdaddy/current.json
This single command:
- Registers you as an agent
- Starts a new session
- Writes context to
.portdaddy/current.json
done -- End Everything
$ pd done "Auth complete, tests passing"
Session ended with note
Agent unregistered
Context cleaned up
This:
- Ends the active session with a closing note
- Unregisters the agent
- Cleans up
.portdaddy/current.json
whoami -- Check Context
$ pd whoami
Agent: agent-a1b2c3
Session: sess-d4e5f6
Purpose: Building auth system
Files: src/auth.ts, src/middleware.ts
Shows your current agent ID, session ID, purpose, and claimed files.
with-lock -- Run Under Lock
$ pd with-lock db-migrations -- npm run migrate
Lock acquired: db-migrations
Running: npm run migrate
...
Lock released: db-migrations
Acquires a lock, runs the command, releases on completion (even on failure).
SDK Equivalent
const pd = new PortDaddy();
const { agentId, sessionId } = await pd.begin({ purpose: 'Building auth' });
// ... do work ...
await pd.done({ note: 'Auth complete' });