Files
Termind/Memory/REFACTOR.md
T
Kaede Akino e9c269ab5e Replace starter skills with built-in skill helpers
Keep previously installed starter skills as ordinary user-owned records. Provide hidden read-only Skill Creator and Skill Installer instructions, use AgentKit 0.13.0 for reviewed complete GitHub package installation, and remove skill seeding and Reset.

Move Hermes Memory below MCP, use Enabled for its switch, and localize its Chinese title as persistent memory. Preserve existing user edits and synchronize user skill packages through the existing atomic store.

Validation: AgentKit 213 tests and iOS 452 tests passed. macOS app 1183 tests passed; shared frameworks passed 231/232 with the existing SpeechWaveformViewTests PNG byte-equality failure. Related skill, sync, localization and UI checks passed. Strict Swift formatting, Chinese localization checks, and git diff --check passed.
2026-09-17 08:34:10 +08:00

44 KiB
Raw Blame History

Termind Refactoring Backlog

This English-only document is the durable record of completed redundancy removal and deliberately retained boundaries; append new findings, require a net code reduction unless the item is explicitly structural, verify references with rg, and preserve SwiftUI/AppKit and platform-specific lifecycle boundaries.

Completed Items

  1. Delete the obsolete SwiftUI transcript tree (2026-08-30): Removed the unreachable legacy transcript, message, command-card, compaction, and plan presentation subgraph while retaining live timestamp and risk components; the build and targeted Transcript tests passed.
  2. Merge repeated ListView hosting bridges (2026-08-30): Introduced HostingListRow and HostingListContent for ordinary SwiftUI-backed rows while retaining dedicated Transcript and Assistant conversation lifecycles; the app build passed before the final parser-verified Connection Log migration.
  3. Consolidate SSHSessionModel initializers (2026-08-30): Routed the two terminal entry points through one private initializer without changing temporary-host semantics; the build passed.
  4. Merge SSH and Serial terminal appearance configuration (2026-08-30): Centralized shared appearance application in TerminalViewState.applyAppearance; the build passed.
  5. Delete redundant SFTP store overloads (2026-08-30): Removed four TransferLibraryModel forwarding overloads in favor of the existing RemoteSessionHostStore entry points; the build passed.
  6. Reuse the Jump Host configuration builder (2026-08-30): Made final SSH configuration reuse sshJumpConfigurations instead of duplicating route validation and error wrapping; the build passed.
  7. Share remote-session connection interaction (2026-08-30): Moved host-key prompts, acceptance, route progress, prompt cleanup, and reconnect presentation into RemoteSessionConnectionController while preserving transport-specific teardown; the Debug build and targeted connection/SFTP tests passed.
  8. Merge short tool-free model text collectors (2026-08-30): Centralized streamed text collection and tool-call rejection for command, title, and compaction services; their targeted tests passed.
  9. Merge provider authorization and session configuration (2026-08-30): Added shared request authorization and ephemeral-session construction while retaining catalog-specific Vertex and empty-secret rules; targeted Provider and ChatProbe tests passed.
  10. Consolidate SwiftData save/rollback templates (2026-08-30): Added a narrow ModelContext.commit helper while retaining semantic two-stage history commits; targeted Connection and SFTP History tests passed.
  11. Merge libssh2 queue/continuation bridges (2026-08-30): Shared the byte-identical serial worker bridge between SSH Exec and SFTP workers; the build passed.
  12. Delete remaining legacy Transcript helpers (2026-08-30): Removed dead streaming, edit-binding, and SwiftUI activity helpers as part of Item 1; targeted Transcript verification passed.
  13. Finish ConversationComposerState migration (2026-08-30): Migrated callers to conversation.composer and deleted four compatibility accessors while preserving attachment mutation hooks; the build and Chat Composer tests passed.
  14. Delete the unreachable toolbar search-menu pipeline (2026-08-30): Removed unused menu-item plumbing, NSMenuDelegate behavior, and the unread find-context kind while preserving query and keyboard behavior; the build passed.
  15. Share Agent SSH prompt conversion (2026-08-30): Moved Journey prompt and passphrase derivation onto AgentSSHAuthenticationRequest for both presentation paths; the build passed.
  16. Extract atomic SFTP remote writes (2026-08-30): Centralized temporary-path creation, handle cleanup, failure unlinking, atomic rename, and progress sampling while keeping data-source loops separate; the build and SFTP tests passed.
  17. Merge remote transfer conflict resolution (2026-08-30): Shared Keep Both selection, remote-directory handling, and file conflict policy without merging distinct job types; the Debug build and targeted SFTP tests passed.
  18. Consolidate SFTP client leases (2026-08-30): Centralized saved-versus-borrowed client acquisition and conditional disconnect while retaining coordinator reservation state; the build and SFTP tests passed.
  19. Centralize legacy tool-presentation metadata (2026-08-30): Replaced scattered historical name mappings with one compatibility table while preserving generic MCP fallback semantics; targeted presentation tests passed.
  20. Delete the test-only presentation action path (2026-08-30): Removed unused automatic action-message construction and compressed English verb forms around production actionKind semantics; targeted presentation tests passed.
  21. Merge tool-detail input unpacking (2026-08-30): Added narrow object/array helpers in AgentToolDetailFormatting while keeping field-specific presenters local; the build passed.
  22. Merge Agent idle sweepers (2026-08-30): Replaced two timer loops with AgentIdleSweeper while callers retain their own registry and emptiness policy; targeted tests passed.
  23. Reuse SidebarSectionHeader (2026-08-30): Extended the shared header for count and collapse state and removed duplicate Assistant/Snippet layouts; the build passed.
  24. Unify Host deletion entry points (2026-08-30): Routed group deletion through the repository/outbox saga and removed direct snapshot-persistence deletion; the Debug build and targeted repository, Snippet, and Port Forwarding tests passed.
  25. Remove uncalled wrappers and constants (2026-08-30): Deleted confirmed-unused Agent preflight, settings, metrics, reconnect, and SSH-status declarations after reference scans; the build passed.
  26. Delete SettingsCollectionPage (2026-08-30): Replaced its two construction sites with the byte-identical SettingsFormPage; the build and focused Settings tests passed.
  27. Merge fixed-height cursor lists (2026-08-30): Shared the adapter used by Snippet Target, Host Chooser, and Export Host lists while excluding dynamic and specialized rows; the build and focused list/chooser tests passed.
  28. Share Agent Exec/SFTP authentication retries (2026-08-30): Extracted a generic authenticated-open loop while preserving explicit connection kinds and result types; the build and all 21 Agent Host Authentication tests passed.
  29. Deduplicate native Transcript risk and confirmation helpers (2026-08-30): Routed both row implementations through one risk-color function and one destructive-command confirmation function; the build passed.
  30. Merge Glass shape modifiers (2026-08-30): Replaced three copied implementations with one shape-parameterized private modifier while preserving public APIs and fallbacks; the build passed.
  31. Consolidate Vault envelope persistence (2026-08-30): Added one helper for insertion/update and upload-state indexing while leaving versioning and merge policy in callers; the build and Vault Sync tests passed.
  32. Share SFTP remote-conflict preflight (2026-08-30): Centralized remote-directory ordering, descendant skipping, and target-kind lookup while retaining separate prepared job types; the build and focused SFTP tests passed.
  33. Centralize effective Vertex mode and credential selection (2026-09-04): Added usesVertexEndpoint and effectiveCredentialRef to ModelProvider, later adapting the former to API-format-based providers; build and Provider verification passed.
  34. Delete newly confirmed dead declarations and decoded metadata (2026-08-30): Removed unused onboarding, Agent, color, trial-test, and runtime Linux-catalog fields while retaining provenance in generated JSON; the build passed.
  35. Derive Conversation run presentation (2026-09-01): Replaced manually synchronized run/streaming state with derivation from one reported state and outstanding queues; state-focused tests, localization, and diff checks passed.
  36. Delete tests that freeze user-facing copy (2026-09-02): Removed 20 copy-only tests and isolated literal assertions while retaining behavioral, persistence, localization-selection, and protocol coverage; the affected target compiled and focused tests passed.
  37. Share checked provider HTTP execution (2026-09-02): Centralized transport-error translation, HTTP validation, and non-2xx handling for model catalogs and probes while keeping request construction and parsing local; the build and all 12 focused tests passed.
  38. Delete the Finder-only native drop wrapper (2026-09-02): Removed the unconstructed NativeFileURLDropTarget while retaining the generalized target and test-facing AppKit initializer; the build and all five File Drop tests passed.
  39. Centralize Context Chip recovery rules (2026-09-02): Shared payload-boundary detection and fallback filename derivation between live attachments and restored references; the build and focused recovery tests passed.
  40. Finish save-or-rollback reuse (2026-09-02): Added ModelContext.savePendingChanges and reused commit for staged Agent, Outbox, AI snapshot, and conversation mutations without changing semantic save boundaries; all 46 focused tests passed.
  41. Share transient overlay chrome (2026-09-02): Replaced three identical surface modifier chains with termindTransientOverlaySurface while keeping content and transitions local; the Debug build passed.
  42. Share SSH form chrome (2026-09-02): Replaced two identical conditional padding/glass/border branches with connectionFormChrome while preserving separate form behavior; formatting and the Debug build passed.
  43. Share Snippet card content (2026-09-02): Extracted SnippetCardContent for the normal card and drag ghost while keeping their interaction and outer chrome distinct; formatting and the Debug build passed.
  44. Share SFTP read-handle lifecycle (2026-09-02): Routed inline reads and both download paths through withRemoteReadHandle while preserving their distinct loops and destination policies; the build and all 47 focused SFTP tests passed.
  45. Share select/deselect-all helpers (2026-09-02): Added ManagedChooserState.allChecked(in:) and toggleAll(in:) for the three identical-enabled-set callers while leaving restricted selection unchanged; the build, localization, and diff checks passed.
  46. Extract AgentKit (2026-09-02): Moved the platform-neutral Agent runtime into the separately versioned package after introducing host-tool, interaction, prompt, and presentation seams; package build/tests/formatting and the app build/full suite passed.
  47. Collapse Workspace navigation commands (2026-09-02): Removed commands shadowed by AppKit, kept the standard workspace shortcuts, and moved split shortcuts off system-owned keys with terminal routing coverage; the build, formatting, and localization checks passed.
  48. Address providers by one URL and API type (2026-09-04): Replaced vendor-kind/default-path branching with explicit inference/base URLs and ModelAPIFormat, migrated persisted schemas safely, and shipped AgentKit 0.4.0/0.5.0; package checks, all 994 app tests, localization, and site build passed.

Later Completed Work

  • StoreKit trial consolidation (2026-09-09): Replaced the local HMAC/Keychain/CloudKit trial system with StoreKit purchasing and a transaction-scoped clock watermark, producing a net 121-line production reduction with commerce checks passing apart from one unrelated catalog expectation.
  • Remove the unused Show Recents preference (2026-09-09): Deleted the unread preference, its toggle/group, and unused labels while retaining the shared Sidebar accessibility localization; builds, formatting, localization, and relevant tests passed.
  • Remove low-value test assertions (2026-09-11): Deleted five redundant tests and literal/enum/catalog snapshots for a net 77-line test reduction while retaining behavioral coverage; all relevant checks passed aside from an intermittent unchanged focus test that passed on rerun.
  • Remove the duplicate screenshot window host (2026-09-11): Deleted ScreenshotDemoWindow and reused the production WindowGroup with demo restoration disabled; the full pinned test run, native capture, formatting, and localization checks passed.
  • Share SFTP permission controls (2026-09-11): Moved permission draft behavior to Domain and a shared SwiftUI grid to Presentation for both editors; regression verification is recorded in MOBILE_ROLLOUT.md.
  • Share mobile settings and terminal behavior (2026-09-11): Moved CloudKit, settings transaction/journal, terminal settings, and command-history behavior into their owning frameworks with only desktop adapters retained; shared/mobile tests passed and full macOS verification retained known Agent timing failures.
  • Share Metrics and connection presentation (2026-09-11): Moved monitoring/Journey state to Application and portable panels/forms to Presentation while retaining native keyboard and log handling; shared/mobile and 127 focused macOS tests passed.
  • Share AI settings business logic (2026-09-11): Moved the skill library, importer, and role form into Application, Infrastructure, and Presentation respectively while retaining native editors and panels; the isolated build and 81 mobile/shared tests passed.
  • Share Assistant execution (2026-09-12): Moved runtime, tool adapters, attachments, speech, conversation projection, and transcript list behavior into owning frameworks for both apps; builds, Assistant/navigation tests, localization, and formatting passed apart from an unrelated mobile Metrics race that passed on rerun.
  • Remove app-target forwarding aliases (2026-09-12): Deleted 86 pure-forwarder files, 224 app aliases, and 20 Persistence compatibility aliases while preserving six responsibility-named adapters; both builds, architecture guards, and the complete TFI test action passed.
  • Align the mobile target with desktop layers (2026-09-12): Reorganized TFI into the shared layer model, moved connection construction to Infrastructure, and centralized interface-idiom policy; both builds, architecture tests, and the complete TFI tests passed.
  • Share terminal draft and generation lifecycles (2026-09-12): Extracted TerminalCommandDraftController and CommandGenerationCoordinator with shared timeouts, cancellation, and protocol constants; focused mobile and desktop tests passed.
  • Separate remote-directory policy from SFTP transport (2026-09-12): Moved RemoteFile to Domain, introduced an Application RemoteFileSystem port, and extracted MobileSFTPSessionModel, accepting a structural net increase to enforce the dependency boundary; builds, architecture guards, and SFTP tests passed.
  • Finish mobile adoption of shared connection policy (2026-09-12): Made RemoteSessionConnectionController own mobile Host Key decisions and route progress and shared temporary-key preparation between Workspace and Metrics; focused connection, Journey, Metrics, and recovery tests passed.
  • Share terminal Find state (2026-09-12): Replaced three desktop/mobile query state machines with one Application TerminalFindController while retaining platform binding closures; direct and platform tests passed.
  • Derive remote distributions once (2026-09-12): Centralized Linux distribution detection in Domain with explicit unavailable-versus-conclusive results; Domain, Host projection, and mobile Workspace tests passed.
  • Share platform-neutral Connection Journey sections (2026-09-12): Moved header and status sections to Presentation while retaining native logs, failures, backgrounds, and keyboard handling, reducing production code by 98 lines; builds and Journey tests passed.
  • Own Ghostty appearance in Presentation (2026-09-12): Replaced duplicated desktop/mobile theme conversion with one shared bridge while retaining desktop preference storage; both builds and terminal theme tests passed without dependency changes.
  • Share terminal-upload availability and notices (2026-09-12): Centralized readiness policy and notice presentation while retaining distinct desktop and mobile execution; direct policy tests and both builds passed.
  • Share Known Host presentation titles (2026-09-12): Moved hashed-address versus endpoint title selection to Presentation while leaving platform cards distinct; direct presentation tests and both builds passed.
  • Restrict ListViewKit to native-list workloads (2026-09-12): Removed eight unnecessary macOS adapters and eleven mounts, later retaining narrow UIKit transcript/history uses, for a net 611-line macOS reduction; builds, focused tests, formatting, localization, and boundary checks passed.
  • Share Assistant transcript presentation (2026-09-12): Moved platform-neutral tool/result, disclosure, timestamp, and Markdown policy into Presentation while retaining native renderers and viewport ownership; architecture records and both builds verify the boundary.
  • Remove Periphery-confirmed dead code (2026-09-12): Deleted 34 imports, three empty files, and confirmed-unused declarations for a net 150-line production reduction while preserving dynamic and protocol entry points; builds, focused tests, formatting, localization, and diff checks passed.
  • Remove UI implementation-type assertions (2026-09-12): Deleted tests and helpers that pinned concrete AppKit/UIKit/ListViewKit types while retaining behavioral rendering, identity, reuse, interaction, and environment coverage.
  • Remove obsolete app localizations (2026-09-13): Deleted 81 compiler-confirmed unused catalog entries and three obsolete test expectations and cleared only verified stale metadata; both builds and all localization/language checks passed.
  • Register cross-platform Assistant slash commands (2026-09-13): Replaced duplicate desktop/mobile command catalogs and execution switches with ChatSlashCommandRegistry and explicit platform registration; both builds and focused registry, desktop, and mobile tests passed.
  • Register mobile feature destinations (2026-09-13): Replaced separate tab/sidebar metadata and destination switches with an injected MobileFeatureRegistry while keeping it app-owned; the iOS build and all 28 focused navigation tests passed.
  • Share remaining mobile and desktop policies (2026-09-13): Centralized tree layout, route planning, Host deletion, display projections, Snippet/model rules, SFTP drag values, and service composition in their owning layers while retaining native UI and transport lifecycles; both builds and focused shared/mobile tests passed.
  • Move trials to annual-subscription introductory offers (2026-09-13): Retired the zero-price trial product for new sales, retained it only as a legacy entitlement, and made offer presence, eligibility, duration, price, period, and expiration come entirely from StoreKit annual-subscription metadata.
  • Remove brittle and redundant unit tests (2026-09-13): Removed 27 source-text UI snapshots from MobileNavigationParityTests, seven more app source snapshots, real Keychain and status-item integration tests coupled to host state, and duplicated shared permission/history coverage while retaining architecture, persistence, behavioral, and opt-in screenshot checks. Shared credential-storage compatibility, permission defaults, and History limits now live in FrameworkTests; the change removes a net 1,303 lines. All 1,079 macOS app tests, 13 focused shared tests, 218 iOS tests, strict formatting, localization, and diff checks passed; the pre-existing SpeechWaveformViewTests bitmap-equality failure remains outside this cleanup.
  • Remove standalone-trial compatibility (2026-09-14): A fresh reference scan confirmed that the retired product identifier, legacy domain value, clock guard, and two legacy entitlement states formed one isolated compatibility path with an estimated 90-line production reduction. Deleted that path, its local StoreKit product, UI states, tests, and copy; renamed the permanent identifier to lifetimeProductID; and retained annual introductory trials as the sole trial mechanism. Strict formatting, localization, site build, all 1,091 macOS app tests, the rerun Metrics suite, and all 187 shared iOS tests passed. The iOS target built, while 10 unrelated toolbar-inspection tests remained failing in both the full run and an isolated rerun.

Deliberately Retained Boundaries

  • Native Transcript/AppKit rendering, Assistant conversation rows, and specialized dynamic or drag/drop lists keep dedicated lifecycles instead of being forced through generic SwiftUI hosting abstractions.
  • SSH, SFTP, Serial, desktop, and mobile implementations share only platform-neutral policy; transport startup, credential persistence, teardown, logs, interaction, and native presentation remain separate where behavior differs.
  • SwiftData historical schemas remain frozen migration contracts, small structurally similar repositories and views remain separate when abstraction would not reduce code, and RuntimeVersions stays platform-local to avoid introducing an invalid Ghostty dependency.

The 2026-09-02 completion and re-verification scans found no further independent dead-code or exact-duplication change that met the backlog's reduction and boundary-preservation rules; later work should be appended only after a fresh reference scan.

Fresh Refactoring Pass (2026-09-16)

  • Reuse the shared SFTP download planner — completed. Evidence: rg -n 'PreparedJob|PreparedBatch|pendingBatch|keepBothLocalURL' TFM TFI Frameworks TFMTests TFITests found only one desktop PreparedJob/PreparedBatch construction path, in SFTPSessionModel.prepareDownload, with direction fixed to .download and both remote-directory collections empty. Uploads already used SFTPLocalUploadPlanner. SFTPRemoteDownloadPlanner already owned the equivalent download traversal, local conflict policies, scoped destination access, directory creation, and transfer enqueueing for mobile. Adopted that planner in the desktop session and removed the obsolete mixed-direction batch and local helpers, retaining desktop pending-state/error handling, remote-copy policy, and transfer lifetimes. Estimated production reduction: 180 lines; actual reduction: 167 lines, or 59 lines including the added regression tests. Directory-only downloads now create their empty directory trees because the shared batch retains its destination independently of file jobs. The architecture record documents that ownership.

Verification completed on 2026-09-16:

  • All 75 SFTP and architecture tests passed, including three new parameterized/behavioral tests covering ten file/directory conflict, subtree, empty-directory, and cancellation cases. The empty-directory regression fails against the pre-refactor SFTPSessionModel and passes with the final implementation.
  • The full pinned TFM test action built successfully and passed 1,337 of 1,343 tests. Four failures also reproduce with the pre-refactor production source: SettingsSyncTests.providedDatabaseCopyMigratesWithoutReset (expects schema 15, current schema is 17), ModelCapabilityResolverTests.reportedFieldsWinOverCodexAutoReviewOverride, ScrubberWebClientTests.fetchPreflightNeverEscalatesPrivateHTTP, and ChatComposerStateTests.aFailureNoticeIsNotAnAnswerWorthNaming. MetricsJourneyTests.offlineRestoredMetricsReconcileOnMainActor passed on rerun. SSHImportTests.indexedIdentityPlanningHandlesTheImportFileLimit exceeded its two-second wall-clock limit when run concurrently, but passed in isolation against both versions (0.100 seconds with the final source).
  • The full pinned TFI test action on iPhone 17 Pro / iOS 26.5 built successfully and passed 426 of 432 tests, including all 205 framework tests. The unchanged mobile graph retained five failures on isolated rerun: MobileVaultFeatureTests.importRequiresAnExplicitUsernameWhenTheConfigurationOmitsIt and four MobileAssistantTests cases (completeRegistryIncludesRemoteAndBuiltInToolsOnlyForCapableModels, firstNewConversationSendPromotesDraftAndStartsRun, attachmentOnlyFirstSendPromotesTheConversation, and existingConversationSendStillUsesTheDraftExecutionPath). MobileEditorToolbarTests.iconButtonsKeepTheirNamesAndSaveLifecycle passed on rerun.
  • Strict Swift formatting across all production/test targets, Scripts/check-zh-localization.sh, the removed-symbol reference scan, and git diff --check passed. Both full test actions retained -onlyUsePackageVersionsFromResolvedFile; no dependency, localization, or shared production source changed.

Follow-up Reuse and Test Cleanup (2026-09-16)

  • Reuse the shared remote-copy planner — implemented; full verification remains partial. Evidence: rg -n 'PreparedRemoteCopy|pendingRemoteCopyBatch|SFTPRemoteCopyPlanner.enqueue|resolveRemoteDirectories' TFM TFI Frameworks TFMTests TFITests -g '*.swift' confirms the desktop-only batch types and duplicated preparation, conflict resolution, and enqueue loops in SFTPSessionModel; mobile already uses SFTPRemoteCopyPlanner. Replaced the desktop path with that planner and returned directory-mutation information so empty-directory copies still refresh the browser. Retained app-owned pending state, error handling, transfer completion refresh, and the interactive deletion lifecycle. Estimated production reduction: 220 lines; actual reduction: 193 lines. Added behavioral coverage for file/directory and subtree conflicts across all three policies, empty-directory refresh, and pending-copy cancellation; retained the planner's cancellation and validated recursive deletion checks. Upload conflict helpers remain a separate candidate rather than widening this change.
  • Remove copy-only and duplicated test expectations — implemented; full verification remains partial. Evidence: rg -n 'roleLabelsMatchDesktopDefaults|cautionLabelAlsoFitsUnknownCommands|copyApprovalLabelsAndOverwriteWarningUseAppResources|approvalDetailsLocalizeBothEndpointsAndDestructiveWarning|handshakeFailureDescriptionsDistinguishBannerConditions|uploadNoticePresentationUsesOneCrossPlatformMapping' FrameworkTests TFMTests TFITests -g '*.swift' identifies role-label snapshots, a duplicate unknown-command case, repeated cross-platform approval copy checks, and mixed behavior/copy tests. Removed pure copy assertions and duplicate cases, retained unknown-command classification in its parameterized suite, and consolidated approval endpoint values and destructive-warning policy coverage across policies/locales. Preserved diagnostic context, upload gating, and notice payload/state coverage. Also dropped isolated fixed title/icon assertions from otherwise behavioral tests. Estimated test reduction: 50 lines; actual cleanup reduction: 59 lines, excluding 75 net lines of remote-copy regression coverage. Total Swift reduction: 177 lines. Retained architecture guards, language-selection/catalog validation, protocol strings, user-data round trips, and behavioral assertions that contain strings.

Verification and remaining limitations (2026-09-16):

  • The pinned TFM focused test action passed all 200 tests, including SFTP/session/copy, architecture boundaries, tool presentation, handshake diagnostics, SSH import, toolbar behavior, app language, upload availability, and command classification. Result: /tmp/termind-refactor-copy-focused-20260916.xcresult.
  • The pinned full TFM test action built successfully and passed 1,436 of 1,437 tests. The sole failure is the unchanged SpeechWaveformViewTests.waveformRespondsToLevelsAndReduceMotionMakesItStable bitmap equality assertion. An earlier backlog entry records this same test failure; no baseline or isolated rerun was performed in this pass. Result: /tmp/termind-refactor-copy-macos-20260916.xcresult.
  • The full TFI action did not build or execute tests: the supplied simulator destination UUID was unavailable. This is not a passing iOS verification. A fresh device listing found an available booted iPhone 17 Pro, but the owner requested an immediate commit before rerunning either platform.
  • Strict Swift formatting across all production/test targets, Scripts/check-zh-localization.sh, the removed desktop-helper reference scan, and git diff --check passed. Xcode successfully resolved modules that standalone SourceKit could not find. Existing generic SwiftLint file/type/function-size and complexity findings remain outside this independent refactor; no inline suppressions were added. Dependencies and localization catalogs are unchanged.
  • Submitted at the owner's explicit request with these verification limitations retained rather than deleting unrelated behavioral tests to obtain a green result.

Remove Low-Value UI and Source Assertions (2026-09-16)

  • Implemented; full verification in progress. Evidence: rg -n '#filePath|sourceRoot|String\(contentsOf|source\.contains' FrameworkTests TFMTests TFITests -g '*.swift' found 35 architecture tests plus eight source snapshots in Color System, Menu Symbol, SSH Import, Keychain Order, Commerce Configuration, and Mobile Navigation Parity. At the owner's request, removed implementation-spelling/layout snapshots, enum and palette echoes, fixed-canvas render checks, disconnected standard-library sorting tests, and orphaned helpers; trimmed literal copy from mixed behavioral tests. Removed 52 test declarations and a net 1,230 Swift lines against an estimated 1,000–1,200-line reduction. Source assertions dropped from 43 tests to nine narrow module/dependency and ownership guards. The ListViewKit import allowlist now permits removing an importer without requiring a snapshot update, while still rejecting new unapproved importers. Retained language/catalog validation, protocol/data contracts, behavioral lifecycle/rendering coverage, and opt-in screenshot capture. Grouped host-list coverage now checks row placement using fixture data rather than localized headings. No production, dependency, or localization catalog changed; existing architecture-document edits were preserved.

Verification in progress:

  • Initial pinned Xcode checks passed all 18 selected macOS tests and five selected iOS tests, compiling both test targets. Results: /tmp/termind-test-cleanup-initial-macos.xcresult and /tmp/termind-test-cleanup-initial-ios.xcresult.
  • Strict Swift formatting across production/test targets, Scripts/check-zh-localization.sh, the remaining-source-assertion scan, and git diff --check passed. Active standalone SourceKit checks could not resolve the Xcode test module graph and were partly inconclusive; Xcode compilation is the authoritative check. Pre-existing generic SwiftLint size, tuple, pixel-coordinate naming, and force-try findings were left outside this deletion; no inline suppressions were added.
  • Full pinned macOS and iOS test actions are running sequentially. No unrelated behavioral test is being removed to hide a failing result.

Share SFTP Transfer Status Labels (2026-09-16)

  • Implemented and verified with existing iOS failures. Evidence: rg -n 'status\(for: transfer\)|transfer\.state\.label' TFM TFI found a mobile-only direction/state mapping and two generic desktop labels. Moved the agreed running/completed direction labels into Presentation, reused generic labels for other states, and connected both apps to the shared property. Production reduction: eight lines, matching the estimate. Existing translations and transport behavior are unchanged.
  • The pinned full TFM action passed all 1,183 app tests and 213 shared tests, including language and architecture checks. Result: /tmp/termind-sftp-status-macos-20260916.xcresult.
  • The pinned full TFI action compiled both targets and passed 212 of 217 app tests plus all 213 shared tests. Its five failures in MobileAssistantTests and MobileVaultFeatureTests match the pre-change /tmp/termind-test-cleanup-full-ios.log exactly; no unrelated tests were changed. Result: /tmp/termind-sftp-status-ios-20260916.xcresult.
  • Strict Swift formatting, Scripts/check-zh-localization.sh, and git diff --check passed. Visually reviewed English, Simplified Chinese, and Traditional Chinese status matrices rendered from the built shared property and app localization resources in /tmp/termind-sftp-status-preview/; these are label previews, not live transfer screenshots.

Retire the Desktop Forwarding Editor Adapter

  • Implemented; verification pending (reproduced iOS failures). Evidence: rg -n 'PortForwardingEditorState|PortForwardingEditorPolicy' TFM TFI Frameworks TFMTests TFITests FrameworkTests Memory Termind.xcodeproj -g '*.swift' -g '*.md' -g '*.pbxproj' confirms that the 43-line desktop adapter has only three production consumers, all computed state getters in TFM/Features/Ports/PortForwardingView.swift, and seven desktop tests. It already delegates saved eligibility and normalization to Application's existing PortForwardingEditorPolicy; its remaining flags derive identically from enabled intent and runtime activity. Mobile already uses the policy directly. Action: adopt that policy in the three desktop getters and delete the adapter, retaining synchronous observable saved-rule/saved-host/controller reads and full runtime values for native presentation. Preserve all callbacks, enabled intent OR activity, draft normalization, saved-host lookup by the editor host's ID, and editing locks. Retarget all seven desktop test behaviors and add shared-policy eligibility/intent/activity coverage. Estimated production reduction: 27–28 Swift lines; test additions counted separately. No architecture invariant changes, boundary-guard edits, public API, dependency, persistence, runtime, approval, secret, or localization changes are required.

  • Implementation outcome: removed the adapter without a replacement wrapper; production Swift decreased by 27 lines (43 deleted, 16 net added to the view). All seven desktop test behaviors remain, including the AppModel save-without-start integration and saved-host lookup through a changed draft host's ID. Expanded active-phase coverage across both intent values, local/remote normalization boundaries and missing targets, and invalid hidden dynamic targets. Added 14 shared-policy matrix/eligibility cases. Test Swift increased by 109 lines; total Swift increased by 82 lines, with regression additions reported separately from the production reduction. Architecture records/guards, feature integration suites, native copy, shared production code, and pinned dependencies are unchanged.

  • Reviews: both independent code reviews and the prior final audit found no code issue or requested revision. This documentation audit independently inspected the actual diff and unchanged shared policy and found no behavior or boundary issue. Only this appended entry was updated; every earlier entry is preserved.

Verification audit (2026-09-16 UTC):

  • The prior pinned focused TFM action passed 33/33 tests, zero failures/skips: 14 forwarding feature, seven editor, nine architecture, and three shared-policy tests (the latter cover 14 parameterized cases). Independently re-extracted /tmp/termind-forwarding-adapter-verify.xMtOCK/focused.xcresult and checked focused.log and focused.command.txt in that directory; the action was not repeated.
  • The full pinned TFM action passed 1,399/1,399 tests (1,183 TFMTests + 216 FrameworkTests), zero failures/skips, exit 0. Result: /tmp/termind-forwarding-adapter-recovery.eggzSE/remaining-checks.9wl35uwk/macos.xcresult.
  • The full pinned TFI action passed 428/433 tests (212/217 TFITests + 216/216 FrameworkTests), five failures, zero skips, exit 65. Result: /tmp/termind-forwarding-adapter-recovery.eggzSE/remaining-checks.9wl35uwk/ios.xcresult. The exact five-test pinned rerun passed 0/5, with the same five identifiers and identical failure text, exit 65: /tmp/termind-forwarding-adapter-recovery.eggzSE/remaining-checks.9wl35uwk/ios-rerun.xcresult. Both used the freshly discovered iPhone 17 Pro / iOS 26.5 simulator, UDID 38789AE8-B5AA-46CA-A15C-77CE760FC550.
  • Actual repeated failures (all in TFITests):
    • MobileAssistantTests/attachmentOnlyFirstSendPromotesTheConversation() and MobileAssistantTests/firstNewConversationSendPromotesDraftAndStartsRun(): Expectation failed: draft.messages.map(\.role) == [.user, .assistant].
    • MobileAssistantTests/completeRegistryIncludesRemoteAndBuiltInToolsOnlyForCapableModels(): Expectation failed: !names.contains("terminal_suggest").
    • MobileAssistantTests/existingConversationSendStillUsesTheDraftExecutionPath(): Expectation failed: conversation.messages.map(\.role) == [.user, .user, .assistant].
    • MobileVaultFeatureTests/importRequiresAnExplicitUsernameWhenTheConfigurationOmitsIt(): Expectation failed: model.canImport.
  • These failures are baseline-unverified, not established pre-existing failures or proven regressions. No pre-change baseline was run for this patch; earlier backlog notes are not substituted for baseline evidence. Their triage/baseline attribution and a passing required iOS verification remain blockers to completion. All planned automated stages reached terminal completion after the prior provider interruption; none is missing, and that interruption was not a test failure or a user-requested stop.
  • Static checks passed: full strict recursive Swift formatting over Frameworks TFM TFI FrameworkTests TFMTests TFITests TermindMCPBridge, Scripts/check-zh-localization.sh, and git diff --check (all exit 0). The first-party Swift retired-symbol scan found no PortForwardingEditorState (expected rg exit 1). The new test's whitespace checks had no diagnostics; the runner initially mislabeled no-index exit 1 (files differ), corrected in untracked-whitespace-adjudication.json without altering raw evidence, with a supplementary read-only scan passing at exit 0. Implementation-stage evidence remains in /tmp/termind-forwarding-adapter-implement.aTsWRl/checks.sh and checks.log.
  • Integrity: before this documentation update, the complete patch, including the untracked test, matched both the focused verifier's initial patch and /tmp/termind-forwarding-adapter-recovery.eggzSE/partial.patch byte-for-byte (SHA-256 f76b9950aa3bb49140865feec1153836f59ce903d25f3a32edcbf07ab320a691). Reviewed production/test bytes remain unchanged. project.pbxproj and Package.resolved hashes match both the saved verification evidence and HEAD; no dependency drift. The same five paths remain uncommitted on main at 8b01a631fefdbe14e1324d87c91d0860124d85d3; no further builds, source/test edits, or commits were made by this audit.
  • Limitations/warnings: native manual status/toggle/edit-lock and save/cancel/back testing was not executed; layout and copy are unchanged, and no visual evidence is claimed. Full-suite xcresult summaries retain 166 macOS runtime warnings (88 environment-locale, 74 constraint, four StoreKit transaction-listener) and 29 iOS warnings (27 environment-locale, two publishing-during-view-update); the targeted rerun reports none. These warnings were not baseline-attributed or broadly investigated. Focused logs also retain native row-height and Xcode diagnostic warnings despite the passing result.
  • Artifacts: /tmp/termind-forwarding-adapter-recovery.eggzSE/remaining-checks.9wl35uwk/ contains verification-report.md, verification-report.json, runner.log, runner.completed.json, per-stage *.command.txt/*.record.json/logs, *-summary.json, *-tests.json, failure-comparison.json, simulator selection, and postverification patch/dependency evidence. Independent re-extractions, count/failure comparisons, before/after integrity, and the post-documentation git diff --check result are preserved in /tmp/termind-forwarding-adapter-recovery.eggzSE/audit-record/.

Repair the Five Repeated iOS Test Failures (2026-09-17)

  • Completed and verified. Before editing, the exact five tests failed on clean d582d711 using the pinned dependencies and iPhone 17 Pro / iOS 26.5. This establishes the baseline for this repair without retroactively claiming a pre-refactor baseline for earlier entries. Result: /tmp/termind-ios-five-fixes.NfgsN4/baseline.xcresult (0/5 passed, exit 65).
  • Three MobileAssistantTests send cases expected a synthetic assistant message from an in-memory app with no Chat model. b2f05217 intentionally replaced that message with a failed run and a separate timeline failure notice. The tests now verify user-only history, failed-run metadata, prompt-to-run association, the visible failure row, and exclusion from title generation. The existing-conversation case awaits the actual failed state rather than yielding 20 times for an assistant message that must not exist.
  • The registry case expected terminal_suggest to be absent on mobile. df3bd04c intentionally stabilized definitions across surfaces; the executor gates availability from the delivered user snapshot. The test now requires the tool, compares descriptors with and without terminal availability, and still requires an empty registry for models without tool-call capability.
  • The import case directly mutated items[0].host.username after scanning. Since ac165a9a, scanning also builds indexed Identity previews, so the selected Identity retained its invalid empty username. The replacement uses a temporary config and the real SSHImportReader with an explicitly empty default username: invalid input cannot commit anything, then adding User deploy and rescanning rebuilds both previews and imports the correctly linked Host/Identity. The obsolete reader fake was removed; no production mutation API was added for a test-only path.
  • All five original test identifiers are retained; none is skipped, deleted, or marked as an expected failure. Only the two mobile test files and this record change. Production behavior, architecture invariants/guards, localization catalogs, and pinned dependencies remain unchanged.
  • Verification: all five tests passed in three separate Xcode test actions (fixed-repeat.xcresult, focused-2.xcresult, focused-3.xcresult), then the full pinned TFI action passed 433/433 and full TFM action passed 1,399/1,399, both with zero failures/skips (full-ios.xcresult, full-macos.xcresult, exit 0). Although the first action supplied -test-iterations 3, its log contains only one Swift Testing run; two independent actions supply the actual repetition evidence. This resolves the outstanding automated iOS verification blocker in the preceding entry.
  • Full strict recursive Swift formatting, Scripts/check-zh-localization.sh, and whitespace checks passed. Standalone SourceKit probes could not confirm the Xcode test-module graph; the successful Xcode compilation and simulator tests are the authoritative checks. Full results retain 29 iOS and 168 macOS runtime warnings, not investigated or baseline-attributed by this test-only repair; the three focused actions have none. Artifacts and the sequential verification script are under /tmp/termind-ios-five-fixes.NfgsN4/.

2026-09-17 — Replace the single-document skill loader

  • Evidence: load_skill had its own definition, presenter, catalog guidance, and name-based output exemptions. A package file reader now supplies the same bounded SKILL.md behavior plus supporting resources.
  • Action: remove the executable LoadSkillTool and register skill_read_file; retain only the historical presenter ID and replay compatibility.
  • Estimated reduction: remove roughly 100 lines of the superseded loader; package management is an additive feature, not a net code-reduction claim.
  • Status: implemented. AgentKit tests pass; application skill, migration, memory lifecycle, and mobile suites have been exercised.

2026-09-17 — Replace seeded runbooks with immutable skill helpers

  • Evidence: AgentSkillLibrary shipped three editable runbooks; SkillLibraryModel and SettingsSyncPersistence both seeded them, and both apps exposed a destructive library-wide Reset.
  • Action: replace the seeds with two runtime-only skills and remove generation seeding, Reset, and old runbook definitions/fixtures. Previously installed starters remain ordinary user-owned records without content rewriting or automatic deletion. Keep conflict repair in native editors and use the existing atomic skill/sync persistence boundary for package installation.
  • Estimated reduction: roughly 200 production lines from retired runbooks, duplicated seeding and Reset UI, excluding the new installer capability and migration tests.
  • Status: implemented. AgentKit 0.13.0 is signed and published; 213 package tests passed. Existing skills remain user-owned and the Chinese memory label is 持久化记忆 / 持久化記憶.
  • Verification: the final iOS run passed all 452 tests. The macOS app run passed 1,183 tests; AppLanguageTests passed again independently. The refreshed shared-framework run passed 231 of 232 tests, with the existing SpeechWaveformViewTests.waveformRespondsToLevelsAndReduceMotionMakesItStable PNG byte-equality failure remaining. New skill/library/sync tests passed, bilingual native screenshots were reviewed, and strict formatting, Chinese localization and whitespace checks passed.