Commit graph

3 commits

Author SHA1 Message Date
Brooklyn Nicholson
2667bb83f2 test(agent): assert coding_selection non-None before subscripting 2026-06-10 02:01:20 -05:00
Brooklyn Nicholson
76858f5c3e refactor(agent): model coding-context as a frozen RuntimeMode seam
Evolve coding-context from a pair of loose functions into one resolved-once
posture object so the coding/general distinction is decided in a single place
and read by every domain, rather than re-probed ad hoc.

- ContextProfile registry (coding/general): declarative posture data — toolset
  to collapse to, operating brief, plus model_hint/memory_policy seams for
  future routing/memory consumers.
- RuntimeMode: immutable, resolved once via resolve_runtime_mode(); exposes
  toolset_selection() and system_blocks(). Detection is not memoized so a
  long-lived gateway/TUI process can't pin a stale posture.
- Detection now fires on a git repo OR a recognised project root (pyproject,
  package.json, Cargo.toml, go.mod, AGENTS.md, …), walking up to the workspace
  root — additive, so a non-git project dir also counts.
- Enriched operating brief with Cursor-grade patterns: trace symbols before
  editing, never substitute chat code blocks for tool edits, re-read a file
  before retrying a failed patch, cap linter-fix loops (~3) before asking,
  verify deps against the manifest.
- system_prompt routes through coding_system_blocks(); cli/tui keep calling
  coding_selection() (now thin wrappers). Subagents inherit the posture for
  free via existing toolset inheritance + the shared prompt builder.

Back-compat: is_coding_context / coding_selection / build_coding_workspace_block
/ CODING_AGENT_GUIDANCE all preserved.
2026-06-10 00:44:31 -05:00
Brooklyn Nicholson
9b200c3b68 feat(agent): coding-context posture across CLI/TUI/desktop
When Hermes runs on an interactive coding surface (CLI, TUI, desktop app,
ACP) inside a git repo, it now shifts into a coding posture:

- Tool restriction: the toolset collapses to a new `coding` set (files,
  terminal, search, web docs, skills, todo, delegate, vision, browser) plus
  the user's enabled MCP servers. Messaging / TTS / image-gen / smart-home /
  music / cron / computer-use fall away.
- Operating brief: a Cursor-style system block (gather context before
  editing, focused diffs, verify, never fabricate, git is the user's).
- Live workspace snapshot: git root, branch + upstream (ahead/behind),
  worktree, dirty/staged counts, recent commits — built once per session
  (cache-safe; never re-probed per turn).

Activation via `agent.coding_context` (auto|on|off, default auto). `auto`
fires only on interactive surfaces in a git repo; messaging platforms are
never affected. A `--toolsets` flag or `HERMES_TUI_TOOLSETS` pin always wins.
2026-06-10 00:07:26 -05:00