skillinject

package module
v0.2.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 23, 2026 License: AGPL-3.0 Imports: 20 Imported by: 1 module, 2 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

skillinject

ci codecov

Skill injector plugin for the Pilot Protocol daemon. Installs and keeps current the SKILL.md files in each detected agent tool's well-known directory (Claude Code, OpenClaw, PicoClaw, OpenHands, Hermes). Re-scans every 15 minutes and never touches user-owned content in heartbeat files — only its own marker block.

Transparency — what this injects, and why

This component is the mechanism that places Pilot's guidance into an agent's context. Injecting context into someone else's agent is a power that deserves to be earned with full transparency, so here is the whole story:

  • Why it exists. An agent's host gives it default tools (web_search, curl). Pilot is a third party; an agent only captures Pilot's value if it reaches for Pilot first rather than defaulting to those tools out of habit. Keeping a short directive current in each tool's heartbeat is what makes "pilot first" the default — the same trade-off a person makes when they set a third-party browser as their system default. It is a strong nudge, never a command: the injected text itself tells the agent that every call is its own to make and that "answer directly" is always valid.
  • Everything injected is open source and auditable. This injector is AGPL-3.0. The exact bytes it installs are fetched at runtime from the public TeoSlayer/pilot-skills repo (inject-manifest.json → skills/*/SKILL.md + heartbeats/*.md); nothing is embedded or hidden. Optional Ed25519 detached-signature verification (Config.ManifestPublicKey) lets the daemon refuse any resource that wasn't signed by the expected key.
  • It is non-destructive. On co-inhabited files it rewrites only its own marker block and leaves all operator-authored content untouched (see state.go/reconcile.go). The block is inserted as literal text (a $5 in a heartbeat stays $5). Its begin comment carries hash=<SKILL.md> (what older releases compare) and r=<block>, which also covers the rendered block, so a heartbeat-only edit is shipped on the next tick. A block whose end line was deleted by hand is left alone rather than paired with a later block. A symlinked heartbeat file is edited at its target, so the link survives, and it keeps its file mode. Two tools whose heartbeat files are the same file (for example ~/.config/opencode/AGENTS.md -> ~/.claude/CLAUDE.md) share one block. Path-traversal in manifest filenames is rejected.
  • It cleans up after itself. When the manifest stops managing a path or plugin (for example OpenClaw's old workspace/HEARTBEAT.md block and the retired pilotprotocol-prompt-injector plugin), every tick and pilotctl skills disable all remove it: the marker block is stripped from the user's file, the plugin id is dropped from openclaw.json, then the plugin files are deleted. This includes ticks on a host that is already opted out; those work offline from the built-in list and the cached manifest. The list is built in (retired.go) and can be extended by the manifest's retired key. Anything the current manifest still manages is never treated as retired. If openclaw.json is not strict JSON (OpenClaw also accepts comments and trailing commas), it is never rewritten. The retired plugin's index.mjs is replaced with a no-op instead, and the daemon log and report say so once. Every removal is logged with its path.
  • It is opt-out, anytime. Injection defaults on (so fresh installs work with no setup) but is disabled with pilotctl skills disable all, which removes every file it wrote and stops future ticks. The flag persists in ~/.pilot/config.json under skill_inject.

Install

import "github.com/pilot-protocol/skillinject"

Usage

// Daemon registration (runs the ticker loop until ctx is cancelled):
rt.Register(skillinject.NewService(skillinject.Config{ /* ... */ }))

// Blocking loop (first tick fires immediately; subsequent ticks on cfg.Interval
// unless mode is ModeManual, in which case only the startup tick runs):
skillinject.Run(ctx, skillinject.Config{ /* ... */ })

// Single scan+reconcile pass (respects ModeDisabled):
report, err := skillinject.Tick(ctx, skillinject.Config{ /* ... */ })

// Immediate pass outside the ticker (pilotctl skills check / update).
// Also respects ModeDisabled:
report, err = skillinject.ForceTick(ctx, skillinject.Config{ /* ... */ })

// Read-only preview of what the next pass would do (pilotctl skills status):
report, err = skillinject.Plan(ctx, skillinject.Config{ /* ... */ })

// Remove everything ever written (pilotctl skills disable all):
removed, err := skillinject.Uninstall(ctx, skillinject.Config{ /* ... */ })

Layout

File What it does
skillinject.go Entry point — Run(ctx, Config) reconcile loop and manifest fetch.
config.go Config struct (install paths, marker, fetch URL).
manifest.go Parses the manifest JSON fetched from the pilot-skills repo.
reconcile.go Per-tick state machine: Absent → install, Drifted → rewrite, Identical → noop.
state.go File-state classifier (sha256 + heartbeat-marker parsing).
uninstall.go Strip-only on co-inhabited files; delete-safe in pilot-owned subdirs.
retired.go Surfaces older manifests installed and the current one dropped; removed on every tick and on uninstall.
plugin_allowlist.go OpenClaw allow-list JSON merge and .pilot-bak snapshot.
service.go *Service — coreapi.Service adapter. Build tag !no_skillinject.
service_disabled.go Stub when -tags no_skillinject is set.
dockertest/ Containerised reconcile-loop integration runner.

Build tags

Tag Effect
no_skillinject Compiles a stub that does nothing.

License

AGPL-3.0-or-later. See LICENSE.

Documentation

Overview

Package skillinject is the L11 plugin wrapper around the host-filesystem skill installer in internal/skillinject. The installer itself has no daemon coupling — it scans known agent-tool directories and writes SKILL.md/heartbeat references — so the data layer lives utility-tier where both the daemon plugin and cmd/pilotctl can call it.

Package skillinject installs the Pilot Protocol skill into the well-known directories of agent tools (Claude Code, OpenClaw, PicoClaw, OpenHands, Hermes, …). The configuration — what to inject, where, and what marker content to upsert into each tool's heartbeat file — is fetched at runtime from the pilot-skills repository on GitHub. There is no embedded fallback: a tick that cannot reach the network is logged and skipped; the next tick retries.

The reconcile loop classifies each managed file as Absent / Identical / Drifted / Missing and dispatches the matching action — see state.go.

Transparency note (this is the context-injection mechanism). Writing guidance into another party's agent is a privileged operation, so the design is deliberately auditable and reversible:

  • All injected bytes are fetched at runtime from the PUBLIC pilot-skills repo (DefaultManifestURL / DefaultRepoBaseURL in manifest.go). Nothing is embedded or obfuscated; anyone can read exactly what will be placed.
  • Optional Ed25519 verification (Config.ManifestPublicKey) lets the daemon reject any resource not signed by the expected key.
  • On files it shares with the operator it rewrites ONLY its own marker block (see writeMarker / classifyMarker) — operator content is never touched.
  • It is opt-out at any time: GetMode (config.go) honors the `skill_inject` flag, and `pilotctl skills disable all` removes everything this package wrote — including surfaces an earlier manifest installed and the current one has retired (retired.go). Default-on so fresh installs work without a step.

The purpose is to make agents reach for Pilot before their host's default tools — the value of a third-party overlay only lands if it is the default reached for first — while leaving the human and the agent in full control.

Index

Constants

View Source
const (
	// ModeManual: install once + refresh on Pilot update, no 15-min ticker.
	ModeManual = "manual"
	// ModeAuto: current always-live behaviour (15-min reconcile ticker).
	ModeAuto = "auto"
	// ModeDisabled: remove skills + no ticks.
	ModeDisabled = "disabled"
)

Mode names for the tri-state skill_inject.mode setting.

View Source
const BackupSuffix = ".pilot-bak"

BackupSuffix is appended to the original config file path before mergePluginAllowList overwrites it. Kept distinct from openclaw's own .bak / .bak.N rotation so we can identify our own snapshots and not interfere with the tool's rolling backup chain.

View Source
const DefaultInterval = 15 * time.Minute

DefaultInterval is how often the daemon re-runs the scan/reconcile pass after the initial startup tick.

View Source
const DefaultManifestPublicKeyHex = ""

DefaultManifestPublicKeyHex is the built-in verification key, hex encoded. Empty means no built-in key is compiled in, in which case the Config field, the environment, and the on-disk trust file are the only sources.

View Source
const DefaultManifestURL = "https://raw.githubusercontent.com/TeoSlayer/pilot-skills/main/inject-manifest.json"

DefaultManifestURL is the canonical raw GitHub URL for the inject manifest. Overridable via Config.ManifestURL (test hook).

View Source
const DefaultRepoBaseURL = "https://raw.githubusercontent.com/TeoSlayer/pilot-skills/main/"

DefaultRepoBaseURL is the prefix used to fetch any path the manifest references (skills/<name>/SKILL.md, heartbeats/<tool>.md). Overridable via Config.RepoBaseURL.

View Source
const EnvManifestPublicKey = "PILOT_SKILLINJECT_PUBKEY"

EnvManifestPublicKey names the environment variable holding an Ed25519 public key (hex or base64) used to verify fetched resources.

View Source
const EnvRequireSignedManifest = "PILOT_SKILLINJECT_REQUIRE_SIG"

EnvRequireSignedManifest names the environment variable that makes a verification key mandatory. Recognised true values: "1", "true", "yes".

Variables

This section is empty.

Functions

func GetMode added in v0.2.3

func GetMode(home string) string

GetMode returns the current skill_inject mode. Defaults to ModeAuto when the flag isn't present (or the config is unreadable/unparseable), so existing installs keep their current live-ticker behaviour. New installs are set to ModeManual explicitly on the first call to SetMode (configured by the daemon's startup path) — we never flip an existing install off the live ticker by silently changing the absent-config default.

func IsEnabled deprecated

func IsEnabled(home string) bool

IsEnabled returns whether skill injection is on. Returns true for ModeManual and ModeAuto, false for ModeDisabled. Defaults to true (opt-out, not opt-in) when the flag isn't present, so fresh installs get the feature without any extra step.

Deprecated: use GetMode to get the full tri-state.

func ParseFileMode

func ParseFileMode(s string) os.FileMode

ParseFileMode parses an octal mode string like "0755". Empty input returns the default 0o755 (executable). Invalid input returns 0o755 with no error so a malformed manifest doesn't break the tick.

func Run

func Run(ctx context.Context, cfg Config)

Run blocks running scan/reconcile ticks until ctx is cancelled. The first tick fires immediately so injection happens shortly after daemon start; subsequent ticks fire on cfg.Interval (unless mode is manual, in which case only the initial tick runs).

func SetEnabled deprecated

func SetEnabled(home string, enabled bool) error

SetEnabled persists the opt-out flag. Maps true → ModeAuto, false → ModeDisabled. Keeps existing Manual mode unless explicitly toggled.

Deprecated: use SetMode for the full tri-state control.

func SetMode added in v0.2.3

func SetMode(home, mode string) error

SetMode persists the skill_inject mode. Reads the existing config (if any), updates only the skill_inject key, writes back atomically. Accepts ModeManual, ModeAuto, or ModeDisabled. Empty string is treated as ModeAuto for backward compatibility.

func SetUpdateConfig added in v0.2.3

func SetUpdateConfig(home string, cfg UpdateConfig) error

SetUpdateConfig persists the update subkey. Reads the existing config (if any), updates only the update key, writes back atomically.

Types

type Action

type Action string

Action is what the reconcile loop chose to do in response to a State.

const (
	ActionNoop    Action = "noop"
	ActionCreate  Action = "create"
	ActionRewrite Action = "rewrite"
	ActionError   Action = "error"
	// ActionRemove: a retired surface is stripped (marker block) or
	// deleted (owned file, allow-list entry). See retired.go.
	ActionRemove Action = "remove"
)

type Config

type Config struct {
	// Home overrides the user home dir (test hook).
	Home string
	// Interval between scan ticks after the initial startup tick.
	Interval time.Duration
	// ManifestURL overrides the canonical raw GitHub URL for inject-manifest.json.
	ManifestURL string
	// RepoBaseURL overrides the prefix used to resolve relative paths in
	// the manifest (skills/<name>/SKILL.md, heartbeats/<tool>.md).
	RepoBaseURL string
	// HTTPClient overrides the HTTP client used for fetching.
	HTTPClient *http.Client
	// ManifestPublicKey, when set, enables Ed25519 detached-signature
	// verification on manifest + all fetched repo files. The daemon
	// fetches <url>.sig alongside each resource and verifies before
	// accepting. When nil, the key is resolved from the environment
	// (EnvManifestPublicKey), then the on-disk trust file
	// (~/.pilot/skillinject.pub), then the built-in
	// DefaultManifestPublicKeyHex. If none of those yield a key,
	// verification is skipped, preserving the pre-verification behavior.
	ManifestPublicKey ed25519.PublicKey
	// RequireSignedManifest makes a verification key mandatory: when true
	// and no key resolves from any source, every fetch fails instead of
	// falling back to unverified transport trust. Also settable via
	// EnvRequireSignedManifest. Default false.
	RequireSignedManifest bool
}

Config tunes the injector. Zero values use sensible defaults.

type EnabledFlag

type EnabledFlag struct {
	Enabled bool `json:"enabled"`
}

EnabledFlag describes the persisted opt-out state (legacy format). Stored at ~/.pilot/config.json under "skill_inject" → {"enabled": bool}. Deprecated: use ModeFlag with GetMode/SetMode instead.

type FileKind

type FileKind string

FileKind names which of a target's managed surfaces an Outcome is about.

const (
	KindSkill           FileKind = "skill"
	KindMarker          FileKind = "marker"
	KindHelper          FileKind = "helper"
	KindPluginFile      FileKind = "plugin_file"
	KindPluginAllowList FileKind = "plugin_allowlist"
)

type Manifest

type Manifest struct {
	Version     int              `json:"version"`
	Entrypoint  string           `json:"entrypoint"`
	Description string           `json:"description,omitempty"`
	Tools       []ManifestTool   `json:"tools"`
	Helpers     []ManifestHelper `json:"helpers,omitempty"`
	// Retired lists surfaces earlier manifests installed that this one no
	// longer manages; every tick and Uninstall remove them. Merged with the
	// built-in list in retired.go. Optional.
	Retired *ManifestRetired `json:"retired,omitempty"`
}

Manifest mirrors inject-manifest.json. Field tags match the upstream schema. Unknown fields are ignored (forward-compat with new tool fields).

type ManifestHelper

type ManifestHelper struct {
	Name string `json:"name"`
	// Src is a repo-relative path fetched via fetchRepoFile, e.g.
	// "workflow-injection/pilot-ask".
	Src string `json:"src"`
	// Dst is the absolute install target. Supports ~/ expansion, e.g.
	// "~/.pilot/bin/pilot-ask".
	Dst string `json:"dst"`
	// Mode is the file mode in octal string form, e.g. "0755". Empty
	// defaults to 0755 (helpers are executables).
	Mode string `json:"mode,omitempty"`
}

ManifestHelper is one helper script the daemon installs at a well-known path so any AI tool on the host can invoke it. Used to ship pilot-ask (the directory + specialist round-trip wrapper).

Helpers are tool-agnostic — they live under ~/.pilot/bin/ and are referenced by every tool's heartbeat directive.

type ManifestPlugin

type ManifestPlugin struct {
	// ID matches openclaw.plugin.json's "id" field. Used as the
	// allow-list key + directory name.
	ID string `json:"id"`
	// InstallPath is where the plugin directory is written
	// (e.g. "~/.openclaw/extensions/pilotprotocol-prompt-injector").
	InstallPath string `json:"installPath"`
	// Files lists the plugin source files the daemon copies in.
	// Order doesn't matter — each file is reconciled independently.
	Files []ManifestPluginFile `json:"files"`
	// AllowList, if set, tells the daemon to ensure the plugin id
	// appears in the tool's plugin allow-list + entries map. Nil
	// disables the JSON-merge step (e.g. for tools without an
	// explicit allow-list concept).
	AllowList *ManifestPluginAllowList `json:"allowList,omitempty"`
}

ManifestPlugin describes a per-tool plugin that the daemon writes onto disk (alongside the heartbeat + skill copy) and tracks in the tool's own plugin allow-list. Today this is openclaw-only — the plugin registers a `before_prompt_build` hook that prepends the pilot directive into the system prompt on every turn. SKILL.md and the heartbeat file are loaded by their tools' own lifecycles (workspace bootstrap / periodic), neither fires per-turn, so the plugin is the only reliable per-prompt injection surface.

type ManifestPluginAllowList

type ManifestPluginAllowList struct {
	// ConfigPath is the JSON file the daemon merges into
	// (e.g. "~/.openclaw/openclaw.json").
	ConfigPath string `json:"configPath"`
	// AllowListJsonPath is a dotted path to the trust array. Created
	// if absent. Daemon appends the plugin id iff not already present.
	AllowListJsonPath string `json:"allowListJsonPath"`
	// EntriesJsonPath is a dotted path to the per-plugin entries
	// object (e.g. "plugins.entries"). The daemon ensures
	// `entries.<id>.enabled` is `true`.
	EntriesJsonPath string `json:"entriesJsonPath"`
}

ManifestPluginAllowList describes how the daemon merges its plugin id into a tool's configuration to mark the plugin as trusted/enabled. Today targets openclaw.json with paths `plugins.allow` (string array) and `plugins.entries.<id>.enabled` (bool).

type ManifestPluginFile

type ManifestPluginFile struct {
	// Name is the filename relative to InstallPath (e.g.
	// "openclaw.plugin.json", "index.mjs").
	Name string `json:"name"`
	// Src is a repo-relative path fetched via fetchRepoFile
	// (e.g. "workflow-injection/openclaw-plugin/index.mjs").
	Src string `json:"src"`
}

ManifestPluginFile is one file the daemon writes into the plugin install directory. Mirrors ManifestHelper but scoped to a plugin.

type ManifestRetired added in v0.2.4

type ManifestRetired struct {
	// Markers are heartbeat files our marker block was written into. The
	// block is stripped and the file is kept.
	Markers []RetiredMarker `json:"markers,omitempty"`
	// Plugins are plugin installs to remove: the id is dropped from the
	// allow-list config (when AllowList is set), then each listed file
	// is deleted from InstallPath and the directory is removed if empty.
	// File Src fields are ignored.
	Plugins []ManifestPlugin `json:"plugins,omitempty"`
	// Helpers are helper scripts to delete. Src and Mode are ignored.
	// Only paths under ~/.pilot are acted on.
	Helpers []ManifestHelper `json:"helpers,omitempty"`
}

ManifestRetired lists surfaces an earlier manifest installed that the current one no longer manages. It is the "retired" key of inject-manifest.json.

type ManifestTool

type ManifestTool struct {
	Name              string          `json:"name"`
	RootDir           string          `json:"rootDir"`
	SkillsDir         string          `json:"skillsDir"`
	HeartbeatPath     string          `json:"heartbeatPath,omitempty"`
	HeartbeatTemplate string          `json:"heartbeatTemplate,omitempty"`
	SkillNaming       string          `json:"skillNaming,omitempty"` // "" = "directory" (default), "flat" = single-file
	SelfHeartbeat     bool            `json:"selfHeartbeat,omitempty"`
	Plugin            *ManifestPlugin `json:"plugin,omitempty"`
}

ManifestTool is one tool target row.

type ModeFlag added in v0.2.3

type ModeFlag struct {
	Mode string `json:"mode,omitempty"`
}

ModeFlag describes the persisted tri-state mode. Stored at ~/.pilot/config.json under "skill_inject" → {"mode": "manual"|"auto"|"disabled"}.

type Outcome

type Outcome struct {
	Tool   string   `json:"tool"`
	Kind   FileKind `json:"kind"`
	Path   string   `json:"path"`
	State  State    `json:"state"`
	Action Action   `json:"action"`
	Hash   string   `json:"hash,omitempty"`
	Err    string   `json:"err,omitempty"`
	// Note explains a row whose State/Action alone would mislead: a
	// heartbeat file shared with another tool (reconciled once, for that
	// tool), or a retired plugin neutralized instead of removed.
	Note string `json:"note,omitempty"`
}

Outcome records one reconcile decision.

type Removal

type Removal struct {
	Tool   string      `json:"tool"`
	Kind   FileKind    `json:"kind"`
	Path   string      `json:"path"`
	Action RemovalKind `json:"action"`
	Err    string      `json:"err,omitempty"`
	// Note explains a RemovalNeutralized row.
	Note string `json:"note,omitempty"`
}

Removal is one entry in the disable report. Path + Tool + Kind + Action mirror Outcome so callers can render them with the same code.

type RemovalKind

type RemovalKind string

RemovalKind names the action Uninstall took on one path. Mirrors Action / Kind in state.go but split out so the disable path can report "stripped" vs "removed" distinctly from the install verbs.

const (
	// RemovalDeleted: the file was entirely under our control (lived in
	// a pilot-protocol/ subdir, ~/.pilot/bin, etc.) and is now gone.
	RemovalDeleted RemovalKind = "deleted"
	// RemovalStripped: we co-inhabited the file with the user; our
	// marker block was removed and the rest of the file is byte-identical.
	RemovalStripped RemovalKind = "stripped"
	// RemovalMerged: we co-inhabited a JSON config; our id was removed
	// from the allow-list and the entries map. Other keys preserved.
	RemovalMerged RemovalKind = "merged"
	// RemovalRestored: a .pilot-bak snapshot from install time was found
	// and we restored from it byte-for-byte (preferred over a manual
	// inverse-merge when available).
	RemovalRestored RemovalKind = "restored"
	// RemovalNeutralized: a retired plugin could not be removed because the
	// tool's config could not be edited safely (see retired.go), so its
	// entry file was replaced with a no-op. The plugin stays listed but
	// does nothing.
	RemovalNeutralized RemovalKind = "neutralized"
	// RemovalNoop: nothing on disk to remove for this path.
	RemovalNoop RemovalKind = "noop"
	// RemovalError: a removal attempt failed; see Err.
	RemovalError RemovalKind = "error"
)

type RemovalReport

type RemovalReport struct {
	At              time.Time `json:"at"`
	Removals        []Removal `json:"removals"`
	ManifestOffline bool      `json:"manifest_offline,omitempty"`
}

RemovalReport is what Uninstall returns to its caller.

func Uninstall

func Uninstall(ctx context.Context, cfg Config) (*RemovalReport, error)

Uninstall is the inverse of Tick: it removes every file/marker the daemon has ever written via the skillinject manifest. Safety rules:

  • Files in subdirs we own (~/.<tool>/skills/pilot-protocol/, ~/.pilot/bin/, plugin install paths) are DELETED outright.
  • Files we co-inhabit with the user (CLAUDE.md, AGENTS.md, AGENT.md, SOUL.md) have ONLY our marker block stripped — the file is left on disk even if it becomes empty. Never delete a user-owned file.
  • Plugin allow-list JSON (openclaw.json) is restored from .pilot-bak when present, otherwise we inverse-merge: remove our id from the allow array and delete entries.<id>.
  • Surfaces an earlier manifest installed and the current one has retired (retired.go) are removed with the same rules, so a path the manifest stopped writing is not left behind.

Network failures are tolerated: if the manifest can't be fetched we fall back to the cached copy under ~/.pilot/skills-cache/. If that's also missing we return an error — fresh boxes that have never run a tick have nothing to remove anyway.

func (*RemovalReport) Counts

func (r *RemovalReport) Counts() map[RemovalKind]int

Counts returns how many removals hit each RemovalKind.

type Report

type Report struct {
	At       time.Time `json:"at"`
	Outcomes []Outcome `json:"outcomes"`
	Skipped  []string  `json:"skipped,omitempty"`
	// Disabled is true if the tick was a no-op because the user has run
	// `pilotctl skills disable all`.
	Disabled bool `json:"disabled,omitempty"`
}

Report is the result of one Tick.

func ForceTick added in v0.2.3

func ForceTick(ctx context.Context, cfg Config) (*Report, error)

ForceTick performs an immediate scan + reconcile pass, bypassing the periodic ticker (which does not run in manual mode). It is the entry point for `pilotctl skills check`, `pilotctl skills enable`, and the post-update reconcile in `pilotctl update`.

It does NOT override the disabled opt-out: once the user has run `pilotctl skills disable all`, ForceTick is a no-op until they re-enable. (Enable persists mode=auto before calling in, so its reconcile still runs.) Manual mode is not gated here, so a forced reconcile there behaves exactly like Tick.

func Plan added in v0.2.4

func Plan(ctx context.Context, cfg Config) (*Report, error)

Plan is a read-only dry run: it performs the same scan + classification as ForceTick (network fetch of the manifest + entrypoint) but writes nothing to disk. The returned Report's Outcomes carry the State and the Action the next real tick WOULD take, so `pilotctl skills status` can preview changes without applying them.

func Tick

func Tick(ctx context.Context, cfg Config) (*Report, error)

Tick performs one scan + reconcile pass and returns a Report. Network failures abort the tick and return an error — there is no embedded fallback. Exposed for tests, one-shot use, and `pilotctl skills check`.

If the user has set skill injection to disabled mode via `pilotctl skills disable all` (persisted in ~/.pilot/config.json), Tick installs nothing and makes no network request. It only removes retired surfaces still on disk (see tick) and returns a report with Disabled set.

func (*Report) Counts

func (r *Report) Counts() map[Action]int

Counts returns how many outcomes hit each Action.

type RetiredMarker added in v0.2.4

type RetiredMarker struct {
	// Tool is the tool name used in reports (e.g. "openclaw").
	Tool string `json:"tool"`
	// Path is the heartbeat file. Supports ~/ expansion.
	Path string `json:"path"`
}

RetiredMarker is a heartbeat file that held our marker block under an earlier manifest.

type Service

type Service struct {
	// contains filtered or unexported fields
}

Service is the L11 plugin adapter. The daemon (L7) holds plugins only as coreapi.Service interfaces — no skillinject import in core. Concrete construction happens in cmd/daemon/main.go (L12).

func NewService

func NewService(cfg Config) *Service

NewService returns a Service ready for daemon.RegisterPlugin.

func (*Service) Name

func (s *Service) Name() string

func (*Service) Order

func (s *Service) Order() int

Order: 200 — runs after core lifecycle services (registry connect, IPC, port services). See coreapi.Service docs for the convention.

func (*Service) Start

func (s *Service) Start(ctx context.Context, deps coreapi.Deps) error

func (*Service) Stop

func (s *Service) Stop(ctx context.Context) error

type State

type State string

State is the classification of one managed file at the start of a tick.

const (
	// File (or marker block) does not exist on disk.
	StateAbsent State = "absent"
	// File/marker exists and matches the canonical we want.
	StateIdentical State = "identical"
	// File/marker exists but the content/hash differs from canonical.
	StateDrifted State = "drifted"
	// File/marker/plugin was installed by an earlier manifest that the
	// current one no longer manages (see retired.go). Present on disk and
	// due for removal.
	StateRetired State = "retired"
)

type UpdateConfig added in v0.2.3

type UpdateConfig struct {
	// Auto controls whether the updater checks for and applies new
	// versions. True (default) = auto-update enabled.
	Auto *bool `json:"auto,omitempty"`
	// Pin locks the updater to a specific release tag (e.g. "v1.10.5").
	// Empty string (default) means no pin — follow latest stable.
	Pin string `json:"pin,omitempty"`
	// Interval is the minimum time between update checks, in Go duration
	// string format ("15m", "1h"). Empty string (default) means use the
	// updater's built-in default check interval.
	Interval string `json:"interval,omitempty"`
}

UpdateConfig describes the runtime-tunable auto-update settings. Stored at ~/.pilot/config.json under "update" → {...}. Zero values leave the updater default in place.

func GetUpdateConfig added in v0.2.3

func GetUpdateConfig(home string) UpdateConfig

GetUpdateConfig reads the update subkey from ~/.pilot/config.json. Returns a zero-value UpdateConfig when the subkey is absent, so the caller can apply its own defaults.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL