Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Implementation:3641397194 wq Gpt6 Astra basePlan

From Leeroopedia
Knowledge Sources
Domains Configuration_Management, File_Systems
Last Updated 2026-10-26 12:00 GMT

Overview

Concrete tool for computing per-seat write plans that specify which files to write, how, and with what content, provided by the ColdBrew Zero desktop runtime.

Description

The basePlan function generates the write specification for a specific seat: which files to create/modify, what write kind to use (file replace, marked injection, skill, toml, settings, asset), and the rendered pack content. Each of the 11 seats has a custom write list — for example, Codex writes to `prompts/cha-codex.md` + `AGENTS.md` (marked) + `config.toml` (toml) + route skills; Claude writes to `CLAUDE.md` (marked) + `rules/cha-breakopen.md` + route skills.

The plan function wraps `basePlan` and extends it with upstream skill writes via `upstream-skills.extendPlan`. It also handles the `zcode` layout variant for GLM (filtering writes to a nested zcode directory).

Usage

  • Preview: called by `SeatTransactions.preview` to compute the before/after state of all files.
  • Multi-root deploy: called by `runtime.deploy` for seats with multiple config roots (GLM + ZCode).
  • Install orchestrator: called by `selectOne` in `beginner-install.js` (via the `plan` function) with IDA MCP writes merged.

Code Reference

Source Location

Signature

function basePlan(seatId: string, overrideHome?: string) -> {
  home: string,
  writes: Array<WriteItem>,
  begin: string,
  end: string,
  pack: string,
  meta: object
}

function plan(seatId: string, overrideHome?: string, { layout = 'default' } = {}) ->
  basePlan result + upstream skill writes

// WriteItem kinds: 'file' | 'marked' | 'skill' | 'toml' | 'settings' | 'asset'
// Each WriteItem has: { kind, file, mode?, body?, begin?, end?, home?, key?, value?, name?, data?, source? }

Import

const { basePlan, plan, PACK_IDS } = require('./seat-runtime');

I/O Contract

Inputs

Name Type Required Description
seatId string Yes One of PACK_IDS; selects the per-seat write list
overrideHome string No Override the config home directory (default: resolved via seatHomes)
layout string No 'deepseek-harness' | 'zcode' (plan() only)

Outputs

Name Type Description
home string Resolved config home directory
writes Array Per-file write specs (kind, file, body/content)
begin string Marker begin string (e.g., "")
end string Marker end string
pack string Fully rendered pack text
meta object Seat metadata (name, tag, accent, short, mark)
upstream object Upstream skill extension info (added by plan())

Usage Examples

Compute Claude Write Plan

const { basePlan } = require('./seat-runtime');

const spec = basePlan('claude');
console.log(`Home: ${spec.home}`);
console.log(`Pack length: ${spec.pack.length} chars`);
for (const write of spec.writes) {
  console.log(`  ${write.kind}: ${write.file}`);
}
// Output:
//   Home: /home/user/.claude
//   marked: /home/user/.claude/CLAUDE.md
//   file: /home/user/.claude/rules/cha-breakopen.md
//   skill: /home/user/.claude/skills/cha-bin-unlock/SKILL.md
//   ... (80+ route skill writes)

Plan with Upstream Skills

const { plan } = require('./seat-runtime');

// plan() extends basePlan with upstream skill bundle writes
const spec = plan('codex', undefined, { layout: 'default' });
console.log(`Total writes: ${spec.writes.length}`);
console.log(`Upstream: ${JSON.stringify(spec.upstream)}`);

Override Home for Testing

const { basePlan } = require('./seat-runtime');

const spec = basePlan('gemini', '/tmp/test-gemini-home');
console.log(`Home: ${spec.home}`); // /tmp/test-gemini-home

Related Pages

Implements Principle

Requires Environment

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment