Skip to content

[codex] Add history source plugin imports#19

Closed
luca-ctx wants to merge 2 commits into
codex/custom-history-import-formatfrom
codex/history-source-plugins
Closed

[codex] Add history source plugin imports#19
luca-ctx wants to merge 2 commits into
codex/custom-history-import-formatfrom
codex/history-source-plugins

Conversation

@luca-ctx

@luca-ctx luca-ctx commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds local history-source plugin support for custom agent histories on top of the ctx-history-jsonl-v1 import format.

This PR now includes both halves of the intended product shape:

  • explicit plugin imports via ctx import --history-source, --plugin, --history-source-manifest, and ctx import --all;
  • search-time incremental refresh for installed plugin sources that are both enabled: true and refresh: auto.

A plugin is a local manifest plus a command-line exporter. ctx passes the previous cursor through the runtime environment, reads ctx-history-jsonl-v1 JSONL from stdout, validates source identity/machine identity/schema, imports/indexes the records, and stores the updated cursor.

Search Refresh Behavior

ctx search keeps the existing refresh contract:

  • --refresh auto best-effort refreshes native sources and enabled auto plugin sources, then serves existing results if refresh fails;
  • --refresh strict fails if native/plugin refresh fails;
  • --refresh off never runs provider imports or plugin commands;
  • provider-filtered native searches such as --provider codex do not execute custom plugin commands;
  • --provider custom can refresh enabled auto plugin sources.

Plugin execution remains local-command based, not a plugin store or in-process ABI. Third parties can ship their own bridge CLI/script, and users can install it into ctx's plugin discovery paths.

Guardrails

  • Plugin commands are argv arrays, not shell strings.
  • Plugin execution uses a limited inherited environment plus ctx-specific variables.
  • Cursor files are private temporary files and are removed after execution.
  • stdout is capped at 64 MiB and stderr at 256 KiB per run.
  • Timeout now covers child execution plus stdout/stderr pipe draining, including helpers that inherit plugin pipes.
  • ctx setup and ctx sources do not execute plugin commands.

Docs

Updated docs describe the custom history source model, the manifest + exporter contract, search-time refresh behavior, and adapter shapes for DorkOS, OpenClaw, Hermes, and NanoClaw.

Validation

  • cargo fmt --all --check
  • cargo check -p ctx
  • cargo test -p ctx --test cli
  • cargo test -p ctx-history-capture
  • cargo test -p ctx history_source_plugins
  • cargo test -p ctx --test cli search_refresh_strict_times_out_when_plugin_helper_keeps_stdout_open
  • git diff --check

@luca-ctx

luca-ctx commented Jul 1, 2026

Copy link
Copy Markdown
Contributor Author

Closing per maintainer request. Current mainline work has moved past this draft plugin import approach.

@luca-ctx luca-ctx closed this Jul 1, 2026
@luca-ctx luca-ctx reopened this Jul 1, 2026
@luca-ctx

luca-ctx commented Jul 2, 2026

Copy link
Copy Markdown
Contributor Author

Closing as residual/superseded by the 0.15 native provider release path. The shipped stable work went through PRs #21 and #22; plugin architecture can be reopened from a fresh branch/spec if we decide to pick it back up.

@luca-ctx luca-ctx closed this Jul 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant