photon_platform.clerk.focus

Named Human-AI focus bridge persisted atomically in ~/.local/state/clerk/focus.json.

Attributes

DEFAULT_SLOT

Classes

FocusSlot

One pinned Human-AI focus slot inside focus.json.

Functions

default_focus_path([config]) → pathlib.Path

Return the canonical Clerk focus JSON path.

set_focus([path, selected_paths, note, slot, source, ...]) → FocusSlot

Pin a directory/file and optional selection into a named Clerk focus slot.

get_focus([slot, focus_file]) → FocusSlot | None

Read a named focus slot from focus.json.

list_focus_slots(*[, focus_file]) → dict[str, FocusSlot]

Return all currently populated focus slots keyed by slot name.

clear_focus([slot, focus_file]) → bool

Clear a single named slot, or all slots when slot is None.

Module Contents

photon_platform.clerk.focus.DEFAULT_SLOT = 'default'
photon_platform.clerk.focus.default_focus_path(config: photon_platform.clerk.config.ClerkConfig | None = None) → pathlib.Path

Return the canonical Clerk focus JSON path.

class photon_platform.clerk.focus.FocusSlot

One pinned Human-AI focus slot inside focus.json.

slot: str
path: str | None
selected_paths: tuple[str, ...] = ()
note: str | None = None
source: str = 'cli'
updated_at: str = ''
context: dict[str, Any] | None = None
to_dict() → dict[str, Any]

Serialize slot to a JSON-friendly dictionary.

photon_platform.clerk.focus.set_focus(path: pathlib.Path | str | None = None, *, selected_paths: collections.abc.Sequence[pathlib.Path | str] = (), note: str | None = None, slot: str = DEFAULT_SLOT, source: str = 'cli', focus_file: pathlib.Path | None = None, include_context: bool = True) → FocusSlot

Pin a directory/file and optional selection into a named Clerk focus slot.

Parameters:
  • path – Primary focused directory or file path. Defaults to the first selected path when omitted.

  • selected_paths – Optional ordered list of marked files/items.

  • note – Optional human or agent handoff note.

  • slot – Named focus slot (defaults to "default").

  • source – Origin surface ("cli", "svxiv", "ui", "mcp").

  • focus_file – Optional override destination path.

  • include_context – Attach resolved determine_context() metadata when true.

Returns:

The persisted FocusSlot.

photon_platform.clerk.focus.get_focus(slot: str = DEFAULT_SLOT, *, focus_file: pathlib.Path | None = None) → FocusSlot | None

Read a named focus slot from focus.json.

Parameters:
  • slot – Focus slot name (defaults to "default").

  • focus_file – Optional override focus file path.

Returns:

FocusSlot if populated, or None.

photon_platform.clerk.focus.list_focus_slots(*, focus_file: pathlib.Path | None = None) → dict[str, FocusSlot]

Return all currently populated focus slots keyed by slot name.

photon_platform.clerk.focus.clear_focus(slot: str | None = DEFAULT_SLOT, *, focus_file: pathlib.Path | None = None) → bool

Clear a single named slot, or all slots when slot is None.

Parameters:
  • slot – Slot name to remove, or None to clear all slots.

  • focus_file – Optional override focus file path.

Returns:

True if anything was removed, False otherwise.