build_circuit_from_spec
Defines a full neural region—areas, morphologies, mappings and template blocks—from one JSON spec, with dry-run validation before any write.
Instructions
Create a region, its areas, morphologies and mappings from one JSON spec.
Spec keys: region ({title, coordinates_2d, coordinates_3d, parent_region_id?} or
{region_id}), areas ([{name, dimensions, position?, properties?, psp_uniform?}]),
morphologies, mappings ([{src, dst, rules, replace?}]) and templates
(expanded in the spec):
port: [1,1,N] leaky integrator;threshold,psp,input(andleak,refractory); self-hold mapping sized by threshold - input <= s < threshold.onset_pulse:gate-><name>_Onset(one burst) via<name>_Delayinhibition.ring_cpg: N-bin ring with self-hold,lateral_pscexcitation + wrap, inhibition,drivearea, optionalseedand shiftedreadouts; returnspredicted_step_burstsflagged uncalibrated: check the period withrecord_spikes.servo_channel_two_rest: two rest voxels per OPU channel (stance z+1 / z-1) from atonicarea, per-source offset rows with coactive-z compensation, sources inhibiting their own rest neuron.opumust be an existing area driven by a registered agent (its registered coding decides the stance bins;depthmust equal its z depth).phase_window_gate: gate area passingpulsetotargetonly while thephasearea (phase_binsz bins) is insidewindow(list or"a..b"); optional tonicenable; out-of-window phase bins inhibit.threshold,leak,accumulate,*_psc/*_pspandinhibit_psc(default sized) are checked: enable alone < T, pulse alone < T (>= T without enable), enable + pulse >= T, enable + pulse - inhibition < T (V <- V (1 - leak) + I, steady state); a violation fails the dry run.
replace (per mapping, default false): a mapping whose source or destination is an
existing area keeps the rules already on that edge and appends the spec's rules, so running
the same spec twice doubles the rule. Set replace: true to send only the spec's rules
(as update_cortical_mapping does), or list the edge under delete first.
psp_uniform (per area) sets neuron_psp_uniform_distribution. Areas keep FEAGI's
default (off: PSP is split over fan-out); the result warns when an area with two or more
incoming mappings is fed by such areas, since AND-style gates then fail silently.
Memory and plasticity: an area may set cortical_type: "MEMORY" (id must come back with
prefix m), memory properties (temporal_depth, neuron_init_lifespan,
neuron_lifespan_growth_rate, neuron_longterm_mem_threshold, memory_neuron_cap,
ltm_eviction, replay_trigger), mp_encoding (mode or {mode, delta_quantization?,
ratio_quantization?}) and modulators ([ids], area-level, e.g. memory.formation).
Rules take morphology: episodic_memory (must end in a MEMORY area) or
associative_memory (must start in one), and plasticity_mode stdp/rstdp with
plasticity_window, plasticity_eta (0..1], max_weight, plasticity_constant,
ltp_multiplier/ltd_multiplier, eligibility_decay_bursts (rstdp only; rstdp needs
modulators) and delay >= 1. A mapping may carry modulators (applied to rules
without their own) and frozen: true (frozen through FEAGI's plasticity_frozen route
after its rules are written and read back; flag and mode kept; needs a plastic rule). The
freeze is a brain-instance switch, not part of the genome: a genome reload clears it.
Illegal mixes fail the dry run.
Ports: ports ({inputs: [area names], outputs: [area names]}) declares the block's
interface; a real run writes it to the region's designated_inputs / designated_outputs
(PUT /v1/region/region, existing entries kept, read back) and returns created.ports.
A direction given in ports replaces the template defaults (port: area in and out;
onset_pulse: <name>_Onset out; ring_cpg: ring + readouts out, drive in when
it is a spec area; phase_window_gate: gate out). With none declared the result warns
"block has no declared ports" and nothing is guessed. Optional port_encoding
({area name: {kind?, signed?, frame?, positioning?}}, declared ports only) sets author
entries in the same update; see set_port_encoding.
Also: delete ([{src, dst}]: remove those mappings before the new ones are written) and
edit_areas ([{name, properties}] on live areas of region.region_id, which must be an
existing region; add areas to it with ordinary areas entries that carry a position).
dry_run (default) validates and returns the full calls list, sizing numbers and
external area names it would resolve, without any request. A real run (dry_run=false)
aborts before any create on a name conflict, stops at the first failure (no rollback: take
snapshot_genome first) and returns created ids plus a verification read (areas
found, rules and synapse count per mapping, mappings with zero synapses).
Args: spec_json: The spec as a JSON string dry_run: Only validate and list the calls (default True)
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"spec_json": "<spec_json>"
},
"name": "build_circuit_from_spec"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| dry_run | No | ||
| spec_json | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||