Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 16 additions & 15 deletions docs/PLUGIN_API.md
Original file line number Diff line number Diff line change
Expand Up @@ -402,12 +402,10 @@ Explicit directory validation remains strict.
Python paths. `parse_tool(where, data)` resolves a configured ID and validates
settings; `run_tool(use, request, context)` dispatches a validated `ToolUse`.

The older `TOOL_CHOICES`, `TOOL_REGISTRY`, and `PROJECT_TYPE_IDS` exports still
resolve on access for existing callers. The legacy registry dictionary remains
mutable for compatibility; do not mutate it from plugins. Use the explicit
read-only accessor for new code. Likewise, importing a legacy tool-specific
convenience export loads the corresponding executable package. Do not rely on
those exports or private modules when implementing independent plugins.
Use the explicit catalog accessors rather than mutable registry dictionaries
or import-time snapshots. Tool-specific settings, constants and helpers belong
to their owning tool packages, not the shared authoring facade. Independent
plugins should use the documented shared interfaces, not private modules.

## User storage, discovery and validation

Expand Down Expand Up @@ -678,12 +676,12 @@ API or schema generation, and SHA-256 digest. Tool
identity hashes sorted relative file names and contents, excluding bytecode
and `__pycache__`; JSON identity hashes the captured definition bytes.
These portable identities do not include absolute user paths. The trace's
`turn.settings.snapshot` includes `project_type_plugin`, and the selected
`tool.run` span includes `plugin`. Persisted turn parameters include the
`turn.settings.snapshot` includes `project_type_plugin` when available,
and the selected `tool.run` span always includes `plugin` (null if the
identity is unavailable). Persisted turn parameters include the
selected identities as `project_type_plugin` and `tool_plugin` when known.
These describe the package bytes captured during registration, not a proof
of the behavior of arbitrary code or external dependencies. Historical
records need not contain them.
of the behavior of arbitrary code or external dependencies.

## System-testing provenance and replay

Expand All @@ -700,10 +698,13 @@ selected implementation, not just the set of available plugins.
fresh execution. Validation, comparison, and retained-replay receipt reading
use the recorded identities without importing installed plugin packages or
requiring the original project type to exist. The saved profile still must
satisfy its syntax, value, filesystem and recorded-state contracts. Missing
older identities are explicitly `unknown`; a malformed supplied identity is
a recording diagnostic. A difference in identity alone is not a change to
persistent workspace settings and does not invalidate a recording.
satisfy its syntax, value, filesystem and recorded-state contracts. Every
opening configuration requires the complete plugin snapshot, and every tool
execution requires its plugin field. Missing required metadata or malformed
identities block recording validation. Null identities and unavailable
turn identities are `unknown`; no historical identity is inferred. A difference
in identity alone is not a change to persistent workspace settings and does
not invalidate a recording.

Fresh replay preflight resolves the current project type and all tools
required by its definition, the historical configuration, or historical
Expand All @@ -717,7 +718,7 @@ plugin locations are included in this receipt field.

Comparison JSON contains per-workspace and per-aligned-operation
`plugin_provenance` observations. Markdown and notebook reports distinguish
known changes, unknown older identities and one-sided observations (for
known changes, unknown identities and one-sided observations (for
example, a different routed tool); only known changes become plugin identity
differences in `ReplayResult.differences`. Batch reports flag these as
environment changes for review, not answer-quality verdicts. A missing
Expand Down
22 changes: 13 additions & 9 deletions docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -252,9 +252,14 @@ model and parameters in `[source_card_generation]`. These are core settings,
not a way to change active answering or routing sessions. The GUI maintains
effort levels and search-depth steps in the same `profile.ini` through
`kilin.gui.model_settings`; it no longer owns router persistence. These
settings are not a separate active `effort_levels.json` database. The GUI
still supports controlled migration of recognized older files on first use;
moving or deleting files outside that migration is not authorized.
settings are initialized from effective application preferences only when
missing, including when a valid core-created project is first opened in the
GUI. Saved settings take precedence and invalid present values are rejected.
Each effort-level record in GUI settings must have exactly `name` and `model`;
search-depth steps are separate. Historical `effort_levels.json` and
`model_choices.json` sidecars are neither read nor deleted. To retain their
old choices, back up the files and transfer the desired values explicitly
through Settings.

### Source-card indexing policy

Expand Down Expand Up @@ -603,12 +608,11 @@ location for conversations, workspaces or preferences. Documents may be
synchronized by iCloud, OneDrive or another external service; users needing
strictly local project storage should choose a non-synchronized path.

If the previous installed-app `workspaces/` data directory contains project
profiles, GUI setup offers to reuse that folder. Choosing it records a
folder preference without moving or rewriting any project files. Otherwise
KíLín keeps the proposed Documents folder. An existing confirmed choice or
environment override is never silently replaced by legacy detection. See
[GUI architecture](gui_architecture.md) and [GUI README](../kilin/gui/README.md).
Choose any existing projects folder explicitly using Browse. KíLín does
not search former default locations. Selecting a folder records a preference
without moving or rewriting its projects, which must satisfy the current
project format. See [GUI architecture](gui_architecture.md) and
[GUI README](../kilin/gui/README.md).

### Saved project settings take precedence

Expand Down
8 changes: 6 additions & 2 deletions docs/gui_architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,9 @@ user state. A development checkout and an installed distribution can have
different suggested workspace parents. The exact path overrides and
preferences rules are owned by
[Configuration](configuration.md#gui-defaults-and-writable-preferences).
The GUI uses the saved or explicitly selected projects folder without
scanning former default locations. Selecting a folder does not move or
migrate its projects.

`gui/_activation.py` implements the desktop passkey check. It is called
from `gui/app.py`'s `main` after the Qt application exists and before
Expand All @@ -161,8 +164,9 @@ settings or workspace files.

An existing project's profile remains authoritative. `gui/model_settings.py`
stores GUI-specific effort/search/router choices there rather than replacing
them from current global defaults. Its controlled legacy import is not a
general project migration. For changes to the saved source tree or resources,
them from current global defaults. Only missing settings are initialized;
obsolete sidecars are not read or removed. For changes to the saved source
tree or resources,
use the [workspace APIs](project_workspaces.md#creation-opening-and-explicit-updates).

## Operation lifecycle and answer display
Expand Down
2 changes: 1 addition & 1 deletion docs/gui_protocol.md
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,7 @@ can accompany an event.
| --- | --- |
| Setup | `readiness` (`backend`, `ready`, `environment_ready`, `unavailable_reason` (empty unless the selected backend is unsupported), `required_models`, `cached_models`, `missing_models`, `replacements`, `can_use_installed`, `install_command`, `install_commands` (backend-to-command map), `projects_folder`, `folder_confirmed`, `terms`, `terms_version`, `terms_accepted`, `copyright` (the Settings copyright line, built from the package authors)); `installed_models_used` (`replacements`, updated model settings); `backend_preference_saved`, `backend_preference_failed` (Qt events: saved `backend` or failed `backend` and `message`); `terms_acceptance_saved` (`version`); `terms_acceptance_failed` (`version`, `reason`, `message`, and `current_version` for outdated terms) |
| Installation | `installation_started` (`total`, `backend`, `models`: the missing models in download order); `installation_progress` (`index`, `total`, `model_id`, progress details); `installation_model_complete` (`model_id`, elapsed times); `installation_complete` (`elapsed_seconds`) |
| Projects folder (Qt) | `projects_folder` (`folder`: effective folder, `standard`: default without a saved choice, `saved`: saved choice or empty string, `missing`: whether a saved folder is unavailable, `legacy`: previous installed-app root with candidate profiles, or empty); `projects_folder_cancelled` (native Browse dialog dismissed); `projects_folder_failed` (`message`: unable to save or old folder no longer exists) |
| Projects folder (Qt) | `projects_folder` (`folder`: effective folder, `standard`: default without a saved choice, `saved`: saved choice or empty string, `missing`: whether a saved folder is unavailable); `projects_folder_cancelled` (native Browse dialog dismissed); `projects_folder_failed` (`message`: unable to save the chosen folder) |
| Settings/models | `settings` (`profile`, project types, model choices, backend, search depth, `selection_reason_codes`, `thinking_switches`: cached model IDs mapped to `True` when toggling `enable_thinking` changes one sample rendered prompt, `False` when unchanged; omitted when unknown (not verified model reasoning)); `models_applied` (updated levels, models and profile, plus `thinking_switches`); `indexing_applied` (`profile` after the index was rebuilt); `source_cards_applied` (validated settings and card counts), `source_cards_regenerated` (card counts); `answer_settings_saved` (confirmed `temperature`, `thinking`, `max_new_tokens`, plus `request_id` and `project` for correlated saves); `answer_settings_failed` (`request_id`, `project`, `message`, `verified`, plus reconciled settings when verified); `model_download_started`, `model_download_progress`, `model_downloaded` (model ID and download status); `project_behavior` (validated project editor, defaults, revision, and correlated saved or error status); `settings_info` (validated core/tool descriptive catalog), `settings_info_failed` (metadata diagnostic only); `tool_settings` (`tools`, each with `name`, `summary`, `intents`, `settings`, `type_settings`, `per_intent`; after a save also `tool` and `saved` or `error`) |
| Plugins | `plugins` (`request_id`, `operation`, optional `error`, `validation`, `change`, `canceled`, `inventory` with installed, runtime and pending records) |
| Versions | `versions` (`request_id`, `project`, `creation_provenance`, `inventory` or `error`) |
Expand Down
4 changes: 2 additions & 2 deletions docs/model_management.md
Original file line number Diff line number Diff line change
Expand Up @@ -229,8 +229,8 @@ may require controlled evaluation.
`RAGSession` normally holds an answering chat session, embedding session and
possibly a separate router session. The core loads the selected router ID
from the project's `[router]` section (separately for MLX and PyTorch).
When absent, it checks the legacy `effort_levels.json` router choice, then
uses the packaged `DEFAULT_ROUTER_MODEL_*` for the selected backend. An
When absent, it uses the packaged `DEFAULT_ROUTER_MODEL_*` for the selected
backend, unless an initial choice is supplied to `read_router_model()`. An
explicit `RAGSession(router_model=...)` overrides that choice for the
session without changing `profile.ini`. Core callers do not need the GUI
to read or update router configuration: use
Expand Down
10 changes: 6 additions & 4 deletions docs/module_map.md
Original file line number Diff line number Diff line change
Expand Up @@ -257,8 +257,10 @@ unit test. Consult source docstrings and nearby tests for exact contracts.
| [`kilin/system_testing/_comparison_report.py`](../kilin/system_testing/_comparison_report.py) | Render and publish sibling JSON and Markdown comparison reports. | [System testing](system_testing.md) | [System tests](../tests/kilin/system_testing/) |
| [`kilin/system_testing/generation.py`](../kilin/system_testing/generation.py) | Record, validate and publish scripted reference experiments. | [System testing](system_testing.md) | [System tests](../tests/kilin/system_testing/) |
| [`kilin/system_testing/batch.py`](../kilin/system_testing/batch.py) | Run managed experiments and execute independent report notebooks. | [System testing](system_testing.md) | [System tests](../tests/kilin/system_testing/) |
| [`kilin/system_testing/analysis.py`](../kilin/system_testing/analysis.py) | Render saved comparison snapshots, diagnostics and visual reports. | [System testing](system_testing.md) | [System tests](../tests/kilin/system_testing/) |
| [`kilin/_trace_configuration.py`](../kilin/_trace_configuration.py) | Encode complete effective configurations and construct and verify compact references. | [Trace architecture](trace_architecture.md) | [Configuration trace tests](../tests/kilin/test_trace_logging__configuration.py) |
| [`kilin/system_testing/analysis.py`](../kilin/system_testing/analysis.py) | Render saved comparison snapshots and diagnostics with verified local trace references. | [System testing](system_testing.md) | [System tests](../tests/kilin/system_testing/) |
| [`kilin/_trace_configuration.py`](../kilin/_trace_configuration.py) | Encode complete effective configurations and verify exact or path-preserving content references. | [Trace architecture](trace_architecture.md) | [Configuration trace tests](../tests/kilin/test_trace_logging__configuration.py) |
| [`kilin/_trace_snapshots.py`](../kilin/_trace_snapshots.py) | Encode canonical snapshots and verify direct source-group and shared semantic-manifest references. | [Trace architecture](trace_architecture.md) | [Source trace tests](../tests/kilin/test_trace_logging__sources.py), [semantic trace tests](../tests/kilin/test_trace_logging__semantics.py) |
| [`kilin/_trace_json.py`](../kilin/_trace_json.py) | Format long integer arrays compactly without changing diagnostic JSON values. | [Trace architecture](trace_architecture.md) | [Trace JSON tests](../tests/kilin/test__trace_json.py) |
| [`kilin/_trace_project.py`](../kilin/_trace_project.py) | Coordinate project-wide event numbering and shared trace publication. | [Trace architecture](trace_architecture.md) | [Project trace tests](../tests/kilin/test__trace_project.py) |
| [`kilin/trace_logging.py`](../kilin/trace_logging.py) | Record structured execution events and resumable conversation state. | [Trace recording](trace_recording.md) | [Core tests](../tests/kilin/) |
| [`kilin/workspace.py`](../kilin/workspace.py) | Copy selected local sources into a managed multi-source workspace. | [Project workspaces](project_workspaces.md) | [Core tests](../tests/kilin/) |
Expand Down Expand Up @@ -286,11 +288,11 @@ unit test. Consult source docstrings and nearby tests for exact contracts.
| System testing | 22 |
| Tool extension contracts | 29 |
| Tool packages | 2 |
| Trace architecture | 2 |
| Trace architecture | 4 |
| Trace recording | 1 |
| Versioning | 1 |

**Total production Python modules: 242.**
**Total production Python modules: 244.**

## Non-Python resources and UI assets

Expand Down
4 changes: 2 additions & 2 deletions docs/package_defaults.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ identifiers supplied by a project or caller. The identifiers use the form

All eight values must be nonempty strings. Core router selection reads the
project's saved ``[router]`` setting first; the packaged router default
is used only when the project has no saved or legacy router. Explicit
``RAGSession(router_model=...)`` overrides the saved selection for that
is used when the project has no saved router or supplied initial choice.
Explicit ``RAGSession(router_model=...)`` overrides the saved selection for that
session. The GUI may save a user-preference router for a newly created
project. These defaults do not automatically download a model.

Expand Down
8 changes: 4 additions & 4 deletions docs/project_workspaces.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,11 +147,11 @@ numbered-sibling allocation. The final name is reserved exclusively;
import kilin

first = kilin.prepare_sources_workspace(
["/path/to/source"], kilin.PROJECT_TYPE_IDS[0],
["/path/to/source"], kilin.project_type_ids()[0],
workspace_root="/path/to/projects",
)
second = kilin.prepare_sources_workspace(
["/path/to/source"], kilin.PROJECT_TYPE_IDS[0],
["/path/to/source"], kilin.project_type_ids()[0],
workspace_root="/path/to/projects",
)
assert first.root != second.root
Expand All @@ -162,12 +162,12 @@ Both contain no placeholder sources or dummy indexes:

```python
project = kilin.prepare_sources_workspace(
[], kilin.PROJECT_TYPE_IDS[0],
[], kilin.project_type_ids()[0],
workspace_root="/path/to/projects",
)
# For an explicitly chosen name, use the third positional argument instead:
# project = kilin.prepare_sources_workspace(
# [], kilin.PROJECT_TYPE_IDS[0], "/path/to/new_workspace"
# [], kilin.project_type_ids()[0], "/path/to/new_workspace"
# )
project = kilin.add_project_sources(
project.root, ["/path/to/notes.txt"]
Expand Down
13 changes: 7 additions & 6 deletions docs/source_manifest.md
Original file line number Diff line number Diff line change
Expand Up @@ -419,12 +419,13 @@ the returned snapshot is still committed and must not be retried as if it
had rolled back. Lifecycle refresh emits `source_organization.reconciled`
with the same state and identity fields when it changes the manifest. Initial
creation is part of the existing creation operation, not a separate mutation.
System-test validation of older recordings without the semantic command
protocol is limited to default-only additive lifecycle histories with a
complete revision/digest chain. Recordings with the current protocol can
include explicit edits, declarations and automatic-discovery outcomes, but
must contain the complete chronological history. Direct core mutations
without corresponding replayable engine commands are not replayable. See
System-test validation requires the current semantic command protocol and
the complete chronological history, including for default-only assignments.
Recorded creation and lifecycle observations, accepted revision/digest, and
question-start identities must form a consistent history ending at the saved
semantic state. Explicit edits, declarations and automatic-discovery outcomes
are supported. Direct core mutations without corresponding replayable engine
commands are not replayable. See
[semantic source organization in system testing](system_testing.md#semantic-source-organization).

The [headless engine protocol](gui_protocol.md#semantic-source-commands)
Expand Down
Loading
Loading