Config¶
Brain configuration, .spikuit/ discovery, and initialization.
EmbedderConfig
dataclass
¶
EmbedderConfig(provider: str = 'none', base_url: str = '', model: str = '', dimension: int = 768, api_key: str = 'not-needed', timeout: float = 30.0, prefix_style: str = 'none', max_searchable_chars: int = 500)
Embedder configuration parsed from config.toml.
Attributes:
| Name | Type | Description |
|---|---|---|
provider |
str
|
|
base_url |
str
|
API base URL. |
model |
str
|
Model identifier. |
dimension |
int
|
Embedding vector dimension. |
api_key |
str
|
Bearer token (OpenAI-compat only). |
timeout |
float
|
HTTP request timeout in seconds. |
BrainConfig
dataclass
¶
BrainConfig(name: str = 'default', root: Path = (lambda: Path.cwd())(), embedder: EmbedderConfig = EmbedderConfig(), git: GitConfig = GitConfig())
Full Brain configuration — parsed from .spikuit/config.toml.
Attributes:
| Name | Type | Description |
|---|---|---|
name |
str
|
Brain name (defaults to directory name). |
root |
Path
|
Directory containing |
embedder |
EmbedderConfig
|
Embedder settings. |
git |
GitConfig
|
Git versioning settings. |
Functions¶
find_spikuit_root ¶
Walk up from start to find a directory containing .spikuit/.
Behaves like git's root discovery — walks parent directories
until .spikuit/ is found or the filesystem root is reached.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
start
|
Path | None
|
Starting directory (defaults to CWD). |
None
|
Returns:
| Type | Description |
|---|---|
Path | None
|
The directory containing |
init_brain ¶
init_brain(path: Path | None = None, *, name: str | None = None, embedder_provider: str = 'none', embedder_base_url: str = '', embedder_model: str = '', embedder_dimension: int = 768, embedder_prefix_style: str = 'none') -> BrainConfig
Initialize a new .spikuit/ directory with config.toml.
Creates the directory structure and writes a config file.
Equivalent to spkt init.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
Path | None
|
Target directory (defaults to CWD). |
None
|
name
|
str | None
|
Brain name (defaults to directory name). |
None
|
embedder_provider
|
str
|
|
'none'
|
embedder_base_url
|
str
|
API base URL for embedder. |
''
|
embedder_model
|
str
|
Model identifier for embedder. |
''
|
embedder_dimension
|
int
|
Embedding vector dimension. |
768
|
Returns:
| Type | Description |
|---|---|
BrainConfig
|
The BrainConfig for the initialized brain. |
Raises:
| Type | Description |
|---|---|
FileExistsError
|
If |
load_config ¶
Load BrainConfig from .spikuit/config.toml.
If root is None, walks up from CWD to find .spikuit/. Falls back to ~/.spikuit/ if no project-local config found.