Help us shape the future of Go! Take the 2026 Go Developer Survey

sandbox

package
v0.2.10 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 17, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package sandbox provisions a per-project scratch workspace under ~/.forge/sandbox/<slug> so the built-in agent has somewhere to edit temp files, work through thinking, prototype code and write logs without touching the user's workspace. Layout:

~/.forge/sandbox/<project-slug>/
  tmp/        throwaway scratch, pruned by SweepTemp
  thinking/   scratch notes and working-through problems
  coding/     temp code experiments
  logs/       agent-written session logs

Index

Constants

View Source
const (
	DirTmp      = "tmp"
	DirThinking = "thinking"
	DirCoding   = "coding"
	DirLogs     = "logs"
)

Sub directories created inside every sandbox.

Variables

This section is empty.

Functions

func Ensure

func Ensure(projectPath string) (string, error)

Ensure provisions the sandbox for projectPath (creating all sub dirs) and returns its root. Safe to call repeatedly — every step is idempotent and cheap, so per-turn callers can rely on it.

func Sub

func Sub(projectPath, sub string) (string, error)

Sub returns the path of one sandbox sub directory for projectPath, provisioning the sandbox first.

func SweepTemp

func SweepTemp(maxAge time.Duration)

SweepTemp removes files and directories older than maxAge from every sandbox's tmp/ directory. Other sub directories are never touched. It scans all sandboxes (every slug under ~/.forge/sandbox), so it can run once at startup without knowing which projects exist.

func Under

func Under(projectPath, path string) bool

Under reports whether path is inside projectPath's sandbox root.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL