Workspace¶
The on-disk research project.
workspace
¶
The on-disk research project: layout, discovery, reads, and writes.
A research project is structured as plain, durable files on disk: - science.toml: Project configuration and tool definitions. - GOAL.md: Single source of truth for the overarching research question. - LEARNINGS.md: Append-only empirical memory repository. - CAMPAIGN.md: Aggregated leaderboard and lineage overview. - tools/: Local Python tools. - research/: Experiment directories containing hypotheses, workflows, and runs.
ProjectError
¶
Bases: RuntimeError
Raised when the project workspace is missing, invalid, or corrupted.
ToolProvider
dataclass
¶
One declared tool provider.
Attributes:
| Name | Type | Description |
|---|---|---|
name |
str
|
Tool provider name. |
kind |
str
|
Provider type ('local', 'stdio', 'http'). |
path |
str
|
Path to local tools directory. |
command |
str
|
Command to start MCP stdio server. |
url |
str
|
URL for remote MCP server. |
token_env |
str
|
Environment variable containing authorization token. |
enabled |
bool
|
Whether this provider is active. |
from_dict
classmethod
¶
Constructs a ToolProvider from dictionary data.
Source code in python/src/science_adk/workspace.py
Config
dataclass
¶
Configuration loaded from science.toml.
Attributes:
| Name | Type | Description |
|---|---|---|
project |
str
|
Name of the research project. |
providers |
list[ToolProvider]
|
List of configured ToolProviders. |
max_optimize_iterations |
int
|
Maximum optimization loop iterations. |
node_timeout_s |
int
|
Execution timeout in seconds per node. |
raw |
dict[str, Any]
|
Complete unparsed configuration dictionary. |
load
classmethod
¶
Loads and parses science.toml from the given path.
Source code in python/src/science_adk/workspace.py
Project
¶
Manages files and directories in a Science ADK research workspace.
Source code in python/src/science_adk/workspace.py
find
classmethod
¶
Discovers the root Project by walking up parent directories.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
start
|
Path | str | None
|
Directory to start searching from (defaults to cwd). |
None
|
Returns:
| Type | Description |
|---|---|
Project
|
Discovered Project instance. |
Raises:
| Type | Description |
|---|---|
ProjectError
|
If no science.toml is found. |
Source code in python/src/science_adk/workspace.py
experiment_dir
¶
runs_dir
¶
run_dir
¶
rel
¶
Formats path relative to the project root for display.
config
¶
read_goal
¶
Reads and parses GOAL.md.
Source code in python/src/science_adk/workspace.py
write_goal
¶
Serializes and writes Goal data to GOAL.md.
Source code in python/src/science_adk/workspace.py
experiment_ids
¶
Returns sorted list of experiment directory IDs.
Source code in python/src/science_adk/workspace.py
experiments
¶
next_experiment_id
¶
Generates a sequential experiment ID slug.
Source code in python/src/science_adk/workspace.py
read_experiment
¶
Reads and parses an experiment's HYPOTHESIS.md file.
Source code in python/src/science_adk/workspace.py
write_experiment
¶
Writes an Experiment model to HYPOTHESIS.md.
Source code in python/src/science_adk/workspace.py
delete_experiment
¶
workflow_path
¶
read_workflow
¶
write_workflow
¶
Writes workflow.json for an experiment.
agent_path
¶
new_run_id
¶
Allocates a unique chronological run ID.
Source code in python/src/science_adk/workspace.py
run_ids
¶
Returns sorted list of run IDs for an experiment.
Source code in python/src/science_adk/workspace.py
latest_run_id
¶
Returns the most recent run ID for an experiment.
Source code in python/src/science_adk/workspace.py
read_trace
¶
Reads trace.json for a specific run.
write_trace
¶
Writes trace.json for a specific run.
score_path
¶
read_score
¶
write_score
¶
data_dir
¶
iter_runs
¶
Yields (run_id, trace) tuples for an experiment.
Source code in python/src/science_adk/workspace.py
best_score
¶
Finds the highest-scoring audited run for an experiment.
Source code in python/src/science_adk/workspace.py
append_learning
¶
Appends an empirical insight to LEARNINGS.md.
Source code in python/src/science_adk/workspace.py
read_learnings
¶
Parses LEARNINGS.md into Learning objects.
Source code in python/src/science_adk/workspace.py
read_json
¶
Reads a JSON file from disk with descriptive error handling.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
Path
|
Path to the JSON file. |
required |
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
Parsed dictionary data. |
Raises:
| Type | Description |
|---|---|
ProjectError
|
If the file is missing or contains invalid JSON. |
Source code in python/src/science_adk/workspace.py
write_json
¶
Writes JSON data atomically to disk with pretty printing.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
Path
|
Target destination path. |
required |
data
|
Any
|
Data to serialize. |
required |
Source code in python/src/science_adk/workspace.py
write_text
¶
Writes text content to disk ensuring a trailing newline.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
Path
|
Target destination path. |
required |
text
|
str
|
String content to write. |
required |
Source code in python/src/science_adk/workspace.py
parse_frontmatter
¶
Parses frontmatter metadata and body from a Markdown document.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text
|
str
|
The raw document text. |
required |
Returns:
| Type | Description |
|---|---|
tuple[dict[str, Any], str]
|
A tuple containing (metadata_dict, body_string). |
Source code in python/src/science_adk/workspace.py
render_frontmatter
¶
Renders dictionary metadata into Markdown frontmatter.