Skip to content

refactor(agent): Phase 0+1 of the agent/ relocation into TinyAgents - #5249

Draft
senamakel wants to merge 4 commits into
tinyhumansai:mainfrom
senamakel:agent-to-tinyagents
Draft

refactor(agent): Phase 0+1 of the agent/ relocation into TinyAgents#5249
senamakel wants to merge 4 commits into
tinyhumansai:mainfrom
senamakel:agent-to-tinyagents

Conversation

@senamakel

Copy link
Copy Markdown
Member

Summary

  • Executes Phase 0 and Phase 1 only of the agent/ → TinyAgents relocation program. No host src/ change; docs, ledger, lockfiles, and the vendored gitlink.
  • Files the relocation plan and its companion transcript design under the dated docs/specs/ convention, and corrects the plan's ground-truth numbers, which were re-derived from the tree and found substantially wrong.
  • Reopens the ledger rows the 2026-07-28 maintainer decision supersedes (AR-1 … AR-4).
  • Bumps vendored tinyagents to 2.1.1, which lands ten host-capability seams with inert defaults — feat(harness): add host capability seams with inert defaults tinyagents#83. Nothing in the host calls them yet.
  • Draft: blocked on Docs: issue/PR templates, CLAUDE workflow notes, PR template filename #83 merging, and on an unresolved design question below.

Problem

The plan relocates src/openhuman/agent/ (152 files, 70,530 LOC) into the vendored crate, inverting ~48 outbound domain dependencies into ~10 capability traits. It is explicitly a multi-quarter program with stop-anywhere phase boundaries.

Phase 0 gates everything after it: "Nothing moves until the trait catalogue is accepted upstream — otherwise the first mover defines the seams by accident." This PR is that gate, and nothing beyond it.

Separately, the plan's own figures could not be reproduced. Since later phases are scoped and measured against them, they had to be corrected before any code moves.

Solution

Phase 0 — trait catalogue filed upstream as docs/spec/host-capabilities-spec.md (#83); ledger rows AR-1 … AR-4 reopened; both specs filed under YYYY-MM-DD-<slug>-design.md and their previously-dangling cross-references reconciled.

Phase 1 — ten traits + inert defaults land in the crate. Version 2.1.0 → 2.1.1, a deliberate patch: the host pins ^2.1, so a minor bump would force a Cargo.toml edit Phase 1 forbids.

Ground-truth corrections (every figure re-derived; methodology recorded in the plan's header):

Claim Stated Measured
Phase 4 exit metric, crate::openhuman:: in harness/session/ ~2,000 547
Outbound domains 45 48
Inbound domains 48 50
agent::harness::* inbound refs 275 300
agent::triage / agent::bus 24 / 14 34 / 25
Crate public traits 18 30
agent/ size; config refs; LOC that stays 152 files / 70,530 / 195 / 20–25k all confirmed (22,121 measured)

The Phase 4 metric was overstated ~3.7×: the entire agent/ tree contains only 1,287 such references, so no scoping reproduces ~2,000. §2.3 also had its outbound/inbound labels swapped. Inbound counts are consistently higher than stated, so the risk §6 already calls "the real cost" is larger than the plan assumed.

Unresolved — needs a decision before Phase 4

All ten traits are generic over State, per the plan's §1 premise that "State is the injection vehicle." The evidence cuts against it. Only 7 of the crate's 18 extension traits carry State, and all 7 are execution traits; the 11 genuine capability traits are bare pub trait X: Send + Sync. And State is currently dead weight here — AgentHarness stores none, every host construction is AgentHarness<()>, and all ~30 host impls are <()>. Adopting a non-unit State is a signature change across all of them that §2.3's cost section does not account for. Discussion is on #83.

Submission Checklist

  • N/A: docs, ledger, lockfile and gitlink only — no host source changed. Test coverage for the new crate surface is in Docs: issue/PR templates, CLAUDE workflow notes, PR template filename #83 (37 tests over the default impls, plus a host_seam_hygiene boundary test).
  • Diff coverage ≥ 80%N/A: no host source lines changed; diff is Markdown, lockfiles, and a submodule pointer.
  • Coverage matrix — N/A: no feature added, removed or renamed.
  • Feature IDs listed under ## RelatedN/A: no feature rows affected.
  • No new external network dependencies — confirmed; the crate bump adds no dependency.
  • Manual smoke checklist — N/A: no release-cut surface touched.
  • Linked issue closed via Closes #NNNN/A: no tracking issue; this executes a spec in-repo.

Impact

Runtime: none. No host code path changes. The crate bump is additive — the ten traits have no caller in either repo, so behavior is byte-identical.

Verified green in both Cargo worlds, including the slim build (a genuine fresh compile, not a cache hit):

cargo test --all-features (vendor/tinyagents)     → 1330 lib + all integration + 45 doctests, 0 failed
cargo clippy --all-features --all-targets -D warnings → clean
GGML_NATIVE=OFF RUST_MIN_STACK=16777216 cargo check --manifest-path Cargo.toml → ok
GGML_NATIVE=OFF cargo check --manifest-path app/src-tauri/Cargo.toml → ok
GGML_NATIVE=OFF cargo check --no-default-features --features tokenjuice-treesitter → ok

Migration/compatibility: none in this PR. The on-disk risk lives in Phase 2, which rewrites the session_raw transcript format on live installs and is deliberately sequenced first and alone. Both specs require a shadow-read parity soak with mismatches logged and never panicked, plus coverage of the legacy DDMMYYYY/ and read_transcript_legacy_md paths.

Lockfiles carry the 2.1.0 → 2.1.1 bump plus pre-existing repair cargo performs on any resolve here: a reqwest 0.12.28reqwest disambiguator normalization (reproduced with the crate version held at 2.1.0), and a tinyhumans-sdk entry missing from the committed app/src-tauri/Cargo.lock (git show HEAD:app/src-tauri/Cargo.lock | grep -c tinyhumans-sdk → 0). Neither is caused by this change.

Related


AI Authored PR Metadata

Linear Issue

  • Key: N/A
  • URL: N/A

Commit & Branch

  • Branch: agent-to-tinyagents
  • Commit SHA: 5ffcbfd07

Validation Run

  • pnpm --filter openhuman-app format:checkN/A: no frontend file changed.
  • pnpm typecheckN/A: no TypeScript changed.
  • Focused tests: cargo test --all-features in vendor/tinyagents → 0 failures across every target.
  • Rust fmt/check: cargo fmt --check clean; cargo check green on the root crate, full and slim feature sets.
  • Tauri fmt/check: cargo check --manifest-path app/src-tauri/Cargo.toml green.

Validation Blocked

  • command: N/A
  • error: N/A
  • impact: N/A

Behavior Changes

  • Intended behavior change: none.
  • User-visible effect: none. Additive crate surface with no caller.

Parity Contract

  • Legacy behavior preserved: fully — no host code path is modified, and the transcript format is untouched until Phase 2.
  • Guard/fallback/dispatch parity checks: the crate's tests/host_seam_hygiene.rs scans the new module for embedder-specific vocabulary (openhuman, composio, action_dir, SOUL.md, …) and fails with file, line, and reason — enforcing the GPL/crates.io publishability boundary as a test rather than a convention.

Duplicate / Superseded PR Handling

  • Duplicate PR(s): none.
  • Canonical PR: this one.

…ntion

Renames plan-agents.md to 2026-07-28-agent-runtime-into-tinyagents-design.md,
which is the name the transcript design doc already links to, so both specs
now cross-reference each other by a resolving relative path.

Corrects every count in the plan against the tree as of 2026-07-28:
outbound domains 45 -> 48, inbound domains 48 -> 50, the Phase 4 exit figure
~2,000 -> 547, the 20-25k 'stays host-side' estimate -> a measured 22,121 LOC,
and eight per-domain reference counts. Records Phases 0 and 1 complete and
Phases 2-7 deliberately not executed.
…ision

Adds rows AR-1..AR-4 to the TinyAgents drift ledger in its existing
'# | Area | Status | Evidence / action' schema, and annotates the
'agent/ remainder - STAYS' verdict in the migration plan's section 7 as
REOPENED (narrowed, not reversed).
@coderabbitai

coderabbitai Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 7bd15e1e-af70-4584-8372-5bb18da5c4fe

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Comment @coderabbitai help to get the list of available commands.

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