Skip to content

dyngai/handoffkit / plugins/handoffkit/skills/handoffkit-scaffold

handoffkit-scaffold

Verified

Built by DynG AI for PlatformPilot.ai-style Go agent runtimes. Use when the user wants to scaffold HandoffKit runtime primitives into a Go project: channel-backed mailboxes, select, router, broker, join/quorum barriers, trace, budget, corpus/compactor, supervisor/nursery, dead letters, and sketch interfaces. Trigger words include PlatformPilot scaffold, scaffold handoffkit, add the HandoffKit runtime, set up message-passing agents, or drop in CSP agent primitives.

references/_src/runtime/trace.go

View on GitHub
package runtime

import "github.com/dyngai/handoffkit/sketch"

// TraceDir is the direction of a traced message relative to an agent.
type TraceDir string

const (
	TraceRecv TraceDir = "recv" // what the agent saw (an inbound message)
	TraceSend TraceDir = "send" // what the agent communicated (an outbound message)
)

// TraceEvent records one message crossing an agent's boundary in its run loop.
// Because all coordination is message-passing, the stream of TraceEvents is a
// COMPLETE record of WHICH messages every agent saw and communicated; there is
// no hidden shared channel to miss. It is not a total order: events carry no
// timestamp or sequence number, so only per-agent (call) order is implied, not
// a global ordering across concurrent agents. Msg owns copies of its slice
// fields, so later message mutations cannot rewrite the recorded event.
type TraceEvent struct {
	Agent sketch.Address
	Dir   TraceDir
	Msg   sketch.Msg
}

// Tracer observes every message an agent receives and emits. It runs inline on
// the agent's run loop, so it must be fast and must not panic: a slow Tracer
// stalls the agent and a panicking one crashes its goroutine. It is also called
// from each agent's goroutine, so it must be safe for concurrent use.
type Tracer func(TraceEvent)

func cloneTraceMsg(m sketch.Msg) sketch.Msg {
	m.Ctx = cloneTraceHandoffContext(m.Ctx)
	return m
}

func cloneTraceHandoffContext(ctx sketch.HandoffContext) sketch.HandoffContext {
	if ctx.Thread != nil {
		ctx.Thread = append([]sketch.Turn(nil), ctx.Thread...)
	}
	if ctx.Refs != nil {
		ctx.Refs = append([]sketch.MemoryRef(nil), ctx.Refs...)
	}
	return ctx
}
reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis.Stars: 471kUpdated Claude CodeCodexVerifiedInstall
diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness.Stars: 322kUpdated Claude CodeCodexVerifiedInstall
dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependenciesStars: 322kUpdated Claude CodeCodexVerifiedInstall
executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is availableStars: 322kUpdated Claude CodeCodexVerifiedInstall