mirror of
https://github.com/PR0M3TH3AN/SeedPass.git
synced 2026-10-27 07:52:03 +00:00
43 KiB
43 KiB
Memory Update: changelog-agent run 2026-02-28
Learnings
- The default branch is
beta.git logshould targetbetainstead ofmainwhen reading history for this repository. - A
CHANGELOG.mdfile exists and we append changes. Since no existing release notes dir was found, I createdreleases/draft-YYYYMMDD.md. - We use
poetry run black .for formatting tests properly, but I reverted the changes totorch/scriptsformatting since they were not meant to be changed by this agent.
Key findings
- The
scheduler-flow.mdscript execution failed due to a missing runner (codex). - The automated
bug-reproducer-agentprompt execution failed. - Fallback manual investigation identified one active issue:
BIP85 Non-Standard Derivation Path(usingapp_no=2instead of standard). This is documented inKNOWN_ISSUES.md.
Patterns / reusable knowledge
- Future runs should verify the runner environment variables (
SCHEDULER_PROMPT_PATH,SCHEDULER_AGENT,SCHEDULER_CADENCE) are set correctly before invokingrun-selected-prompt.mjs. - If the runner fails, manual fallback or alternative automation (e.g., Python script) is required.
Warnings / gotchas
torch/scripts/agent/run-selected-prompt.mjsdepends on an external runner (codexor similar) which may not be available in all environments.
Memory Update — agent-security-foundation — 2026-03-01
Key findings
src/seedpass/cli/agent.pypreviously used a flat policy (allow_kinds/deny_private_reveal) with no rule-level operation, regex, or field matching.- Introducing a versioned rule model can remain backward-compatible by auto-normalizing legacy policy files into structured
rules. - Empty
kindsin deny rules must not be generated unintentionally for legacy migration, otherwise deny rules become wildcard blocks.
Patterns / reusable knowledge
- For agent automation hardening, implement in this order for minimal breakage: policy normalization, enforcement hooks, safe-output redaction, token scoping/TTL/use limits, then append-only audit logging.
- Keep compatibility fields (
allow_kinds,deny_private_reveal,allow_export_import) in the normalized policy output so older tooling still functions. - Tests in
src/tests/test_cli_agent_mode.pyare the right place to cover agent policy regressions and token lease semantics.
Warnings / gotchas
- CI environment may not have global
pytest; use./.venv/bin/pytestin this repo. - Agent command tests that monkeypatch
_load_policywith legacy payloads require in-command normalization to avoid false policy denials.
Memory Update — auth-broker-phase1 — 2026-03-01
Key findings
- A dedicated broker abstraction in
seedpass/core/auth_broker.pyallows non-interactive secret retrieval without coupling broker logic into CLI command modules. - Legacy env-var auth can remain default while enabling keyring/command brokers via explicit CLI options.
- For per-profile non-interactive unlock, defaulting keyring account to fingerprint in
agent getavoids account collisions across profiles.
Patterns / reusable knowledge
- Introduce broker modes in this order:
env(compat),keyring(native OS storage),command(bridge to HSM/YubiKey helper tooling). - Keep broker-specific failures converted to
typer.BadParameterso automation receives consistent deterministic exit behavior. - Agent-mode tests are the fastest place to validate broker migration without touching broader interactive flows.
Warnings / gotchas
keyringpackage is optional in current dependency set; keyring broker must fail with a clear install/error message when unavailable.- Command broker output must be strictly stdout-only password text; any wrapper script should avoid additional logs on stdout.
Memory Update — auth-broker-phase2 — 2026-03-01
Key findings
- Extending broker-based auth to
vault unlockandapi startcan be done without breaking interactive defaults by usingpromptas the default broker. api.start_servercan support non-interactive startup unlock by accepting an optionalunlock_passwordparameter while preserving existing callers.
Patterns / reusable knowledge
- For backward compatibility in CLI tests, keep existing command behavior unchanged unless explicit broker flags are provided.
- Use consistent broker options across commands:
--auth-broker,--password-env,--broker-service,--broker-account,--broker-command.
Warnings / gotchas
- When introducing additional args to helper functions used in tests (
start_server), keep positional compatibility so existing monkeypatched fakes still work.
Memory Update — capabilities-command-v1 — 2026-03-01
Key findings
- Agents benefit from a single deterministic capability map command instead of scraping many
--helpscreens. - A stable JSON schema for capabilities is useful for automation and CI checks; text output can remain user-friendly.
Patterns / reusable knowledge
- Implement capability output with fixed ordering and versioned schema (
schema_version) to reduce churn in downstream parsers. - Expose both CLI and API discovery hints in one surface so agents can bootstrap without external docs.
Warnings / gotchas
- Capability maps can drift from actual commands if manually maintained; future work should generate metadata from command registries.
Memory Update — bootstrap-context-v1 — 2026-03-01
Key findings
- A dedicated
agent bootstrap-contextcommand significantly reduces setup overhead for autonomous agents by returning policy/token/auth posture in one deterministic JSON document. - Treating invalid policy as non-fatal context (
policy.status=invalid) is useful for diagnostics and recovery workflows.
Patterns / reusable knowledge
- Bootstrap context should avoid all sensitive data and include only posture metadata and actionable command hints.
sort_keys=Truefor JSON output improves reproducibility for automated parsers and snapshot tests.
Warnings / gotchas
- Token posture summaries should classify revoked/expired/exhausted separately to avoid misleading “active” counts.
Memory Update — posture-check-v1 — 2026-03-01
Key findings
- A lightweight
agent posture-checkcommand can provide immediate security signal with deterministic output and CI-friendly exit behavior. - Severity thresholding (
--fail-on) is useful for phased rollout: start withcritical, then tighten tohigh/mediumas posture matures.
Patterns / reusable knowledge
- Keep posture findings stable with explicit IDs and severities so automation can suppress or track specific controls over time.
- Treat invalid policy as a critical posture issue but still return full JSON payload for diagnostics.
Warnings / gotchas
- Posture checks that read token store should classify revoked/expired/exhausted tokens separately to avoid false positives on active credentials.
Memory Update — export-policy-gating-v1 — 2026-03-01
Key findings
- Agent-profile export controls are easiest to roll out by introducing explicit context flags (
--agent-profile/X-SeedPass-Agent-Profile) instead of changing default export behavior for all users. - Full-vault export and subset export need separate controls; subset export can be deterministic by filtering encrypted index data by policy-allowed kinds before encryption.
Patterns / reusable knowledge
- Centralize export control logic in a shared module (
seedpass/core/agent_export_policy.py) so CLI and API enforcement remain consistent. - For deterministic subset export payloads, use
json.dumps(..., sort_keys=True, separators=(",",":"))before encryption.
Warnings / gotchas
- Default policy currently allows
totpinallow_kinds; denial tests must provide an explicit restrictive policy fixture when validating blocked TOTP export.
Memory Update — export-reason-codes-audit-v1 — 2026-03-01
Key findings
- Export policy denials are clearer for automation when returned as stable reason codes (
policy_deny:*) rather than free-text strings. - Recording explicit allow/deny export events in a dedicated signed audit log improves traceability without leaking secret material.
Patterns / reusable knowledge
- Use shared policy evaluators (
evaluate_full_export,evaluate_kind_export) across CLI and API to prevent decision drift. - Keep denial code constants centralized in
agent_export_policy.pyso tests and clients can depend on stable semantics.
Warnings / gotchas
- If using restrictive export tests for TOTP, ensure the policy fixture excludes
totp, since default policy allows it.
Memory Update — export-check-v1 — 2026-03-01
Key findings
- A dedicated dry-run command (
agent export-check) reduces failed export attempts and clarifies policy decisions before running sensitive operations. - Optional strict non-zero exit (
--strict-exit) is useful for CI/agent workflows without forcing failures for exploratory checks.
Patterns / reusable knowledge
- Return deterministic JSON fields (
mode,allowed,reason,allow_kinds) so agents can branch behavior without parsing free text. - Reuse shared policy evaluators from
agent_export_policy.pyto keep check and enforcement decisions aligned.
Warnings / gotchas
--mode kindshould require--kind; treat missing kind as input error, not policy denial.
Memory Update — api-export-check-v1 — 2026-03-01
Key findings
- API parity for dry-run export checks (
/api/v1/export/check) lets headless agents preflight export permissions without invoking export operations. - Returning HTTP 200 with
allowed=falsefor policy denials (and 400 only for malformed input like missing kind/invalid mode) keeps control-flow predictable.
Patterns / reusable knowledge
- Keep API and CLI preflight aligned by reusing shared evaluators from
agent_export_policy.py. - Include preflight endpoint in capability discovery output so agents can find it automatically.
Warnings / gotchas
mode=kindshould reject missingkindvia explicitmissing_kinderror code to avoid ambiguous denial semantics.
Memory Update — filtered-export-manifest-v1 — 2026-03-01
Key findings
- Policy-filtered exports benefit from an embedded deterministic
_export_manifestthat captures policy stamp, allowed kinds, redaction fields, and included/excluded entry counts. - The same manifest builder should be reused by CLI and API filtered exports to avoid divergence.
Patterns / reusable knowledge
- Keep manifests deterministic by excluding timestamps and sorting keys/indexes.
- Include a hash-based
policy_stampderived from canonical policy controls to support reproducibility and audit correlation.
Warnings / gotchas
- Changes introducing JSON processing in API or tests require explicit
import json; missing imports can surface as runtime failures in async route tests.
Memory Update — export-manifest-verify-v1 — 2026-03-01
Key findings
- Manifest verification should compare against the current normalized policy controls (not minimal export-only policy fields) to prevent false trust in stale or partial policy states.
- A strict-exit toggle supports both CI gating and exploratory diagnostics.
Patterns / reusable knowledge
- Use stable error identifiers (
policy_stamp_mismatch,allow_kinds_mismatch,included_entry_indexes_mismatch) to make verification machine-actionable. - Keep verification input as plaintext JSON package to avoid coupling verifier with key management/decryption paths.
Warnings / gotchas
- Tests that build and verify manifests must ensure both generator and verifier resolve policy from the same
APP_DIRcontext.
Memory Update — api-manifest-verify-v1 — 2026-03-01
Key findings
- API parity for manifest verification (
/api/v1/export/manifest/verify) enables headless agents to validate filtered export packages without shell access. - Returning verification results as HTTP 200 with
valid+errorssimplifies client control flow compared to mixed status-code semantics.
Patterns / reusable knowledge
- Reuse shared verification primitives from
agent_export_policy.pyacross CLI and API to guarantee identical validation logic. - Add new verification endpoints to
capabilitiesdiscovery output so automation can discover them without hardcoded paths.
Warnings / gotchas
- Policy mismatch tests should mutate
agent_policy.jsonafter package generation to ensurepolicy_stamp_mismatchis exercised reliably. - Implemented approval-gate groundwork (Item 7) for agent-risk export workflows.
- Added
seedpass.core.agent_approvalhelpers for approval issue/list/revoke/consume with TTL, use limits, and revocation persisted in~/.seedpass/agent_approvals.json(0600 perms). - Added policy helper
approval_required(policy, action)and wired policy parsing ofapprovals.require_forthrough export-policy loading. - Added agent CLI commands:
agent approval-issue,agent approval-list,agent approval-revokeand exposed these in bootstrap-context command discovery. - Enforced step-up approval for full vault export when policy requires
export:- CLI:
seedpass vault export --agent-profile --approval-id <id> - API:
POST /api/v1/vault/exportwith headerX-SeedPass-Approval-Id.
- CLI:
- Denials now return policy reasons (
policy_deny:approval_requiredor consumed-approval failures) and are logged through export policy audit events. - Updated capabilities map to include approval commands and
X-SeedPass-Approval-Idas a sensitive header. - Added tests for approval issue/list/revoke plus CLI/API full-export approval gating; targeted suites passing:
src/tests/test_cli_agent_mode.py(27 passed)src/tests/test_typer_cli.py(43 passed)src/tests/test_api_new_endpoints.py(41 passed)
- Extended approval gates (Item 7 scope) beyond export:
- CLI
vault reveal-parent-seednow supports--agent-profile+--approval-idand enforces policyapprovals.require_forforreveal_parent_seed. - API
POST /api/v1/vault/backup-parent-seednow supportsX-SeedPass-Agent-Profile+X-SeedPass-Approval-Idand enforces approval forreveal_parent_seedwhen configured.
- CLI
- Expanded agent private retrieval path:
agent getaccepts--approval-id.- Added private-kind retrieval support for
seed,managed_account,ssh,pgp,nostrwith policy/tokens/redaction pipeline. - Enforced
private_key_retrievalapproval requirement for private kinds with consume-on-use approvals.
- Updated capabilities map high-risk operations to reflect agent sensitive retrieval and backup-parent-seed API path.
- New/updated tests passed:
src/tests/test_cli_agent_mode.py(28 passed)src/tests/test_typer_cli.py(45 passed)src/tests/test_api_new_endpoints.py(43 passed)
- Implemented Item 4 one-time secret leases as first-class agent capability.
- Added
src/seedpass/core/agent_secret_lease.pywith versioned lease store, TTL/use-limit enforcement, revocation, and cross-process locking viautils.file_lock.exclusive_lock. - Added agent lease commands:
agent get --lease-only --ttl <sec> --lease-uses <n>issues a resource-bound lease without returning secret.agent lease-consume <lease_id>consumes one use and returns secret (policy + redaction applied).agent lease-list,agent lease-revokefor lease lifecycle management.
- Lease records are tied to fingerprint/resource and optionally token id metadata; no plaintext secret material is persisted in lease store.
- Updated
agent bootstrap-contextcommand registry to include lease operations. - Updated capabilities map to advertise lease support.
- Added regression tests:
- Lease issue/consume/exhaust flow in
src/tests/test_cli_agent_mode.py. - Capabilities JSON includes
security_features.leasesinsrc/tests/test_typer_cli.py.
- Lease issue/consume/exhaust flow in
- Verified passing suites:
src/tests/test_cli_agent_mode.py(29 passed)src/tests/test_typer_cli.py(45 passed)src/tests/test_api_new_endpoints.py(43 passed)
- Implemented Item 9 agent identities with lifecycle management and token binding.
- Added
src/seedpass/core/agent_identity.py(versioned identity store) with create/list/get/revoke/ensure/active helpers. - Added new agent CLI commands:
agent identity-create --id ... --owner ... --policy-binding ... --rotation-days ...agent identity-list [--show-revoked]agent identity-revoke <id>
- Bound new token issuance to identities:
agent token-issuenow supports--identity-id(defaultdefault-agent) and auto-creates default identity as needed.- Token records include
identity_id.
- Enforced identity state at token use time:
_validate_tokennow denies withtoken_identity_revokedwhen token identity is revoked/missing.
- Updated bootstrap context and capabilities to advertise identity features/commands.
- Added posture findings:
tokens_missing_identitytokens_for_revoked_identity
- Added/updated tests in
src/tests/test_cli_agent_mode.pyandsrc/tests/test_typer_cli.py:- identity create/list/revoke
- token denied after identity revocation
- bootstrap/capabilities include identity command surface
- Verified test suites:
src/tests/test_cli_agent_mode.py(31 passed)src/tests/test_typer_cli.py(45 passed)src/tests/test_api_new_endpoints.py(43 passed)
- Started Item 8 secret-class isolation with a separate high-risk unlock factor/session for agent workflows.
- Added
src/seedpass/core/agent_secret_isolation.py:- stores hashed high-risk factor (
agent_high_risk_factor.hash), - manages per-fingerprint high-risk unlock sessions with TTL (
agent_high_risk_unlock.json), - uses
exclusive_lockfor concurrency-safe session updates.
- stores hashed high-risk factor (
- Extended agent policy schema normalization to include
secret_isolation:enabled(bool),high_risk_kinds(subset of private kinds),unlock_ttl_sec(>=1).
- Added new agent CLI commands:
agent high-risk-factor-setagent high-risk-unlockagent high-risk-statusagent high-risk-lock
- Enforced secret isolation in access paths:
agent getdenies private/high-risk retrieval withpolicy_deny:high_risk_lockedunless unlocked,agent lease-consumeapplies same high-risk lock check for private kinds.
- Updated bootstrap context and capabilities to advertise secret isolation command surface/features.
- Added/updated tests:
- integrated private-kind lock/unlock flow test in
src/tests/test_cli_agent_mode.py, - bootstrap context assertions include secret isolation commands,
- capabilities JSON assertions include
security_features.secret_isolation.
- integrated private-kind lock/unlock flow test in
- Verified suites passing after changes:
src/tests/test_cli_agent_mode.py(32 passed)src/tests/test_typer_cli.py(45 passed)src/tests/test_api_new_endpoints.py(43 passed)
- Continued Item 8 by extending secret-class isolation beyond agent-only retrieval into broader CLI/API high-risk flows.
- Non-agent CLI enforcement updates:
vault reveal-parent-seednow checks high-risk isolation lock when policy isolation is enabled forseedand a high-risk factor is configured.vault exportnow checks high-risk isolation lock under the same conditions before full export.
- API high-risk session endpoints added in
src/seedpass/api.py:GET /api/v1/high-risk/statusPOST /api/v1/high-risk/unlock(requires token + password +X-SeedPass-High-Risk-Factor)POST /api/v1/high-risk/lock
- API high-risk enforcement updates:
/api/v1/vault/exportenforces high-risk unlocked session when export mode/policy includes isolated high-risk kinds./api/v1/vault/backup-parent-seedenforces high-risk unlocked session forseedwhen isolation applies.
- Extended export policy parser (
agent_export_policy.load_export_policy) to supportsecret_isolationfields so API-side isolation decisions are policy-driven. - Capabilities map now advertises new high-risk API endpoints and
X-SeedPass-High-Risk-Factorsensitive header. - Added regression tests:
- CLI: reveal-parent-seed blocked when high-risk locked.
- API: high-risk unlock/status/lock endpoints, export blocked when high-risk locked, backup-parent-seed blocked when high-risk locked.
- Verified passing targeted suites:
src/tests/test_typer_cli.py(46 passed)src/tests/test_api_new_endpoints.py(46 passed)src/tests/test_cli_agent_mode.py(32 passed)
- Advanced Item 8 toward vault/service-layer coverage by adding explicit partition metadata + retrieval gating.
- Added secret-class partition metadata defaults and helpers to
ConfigManager:- default
secret_class_partitionswithstandardandhigh_riskclasses, - helpers:
get_secret_class_partitions,set_secret_class_partitions,set_partition_unlock_state,is_partition_unlocked.
- default
- API service-layer hardening in
src/seedpass/api.py:/api/v1/high-risk/unlockand/api/v1/high-risk/locknow update config partition unlock state (best-effort),/api/v1/entry/{id}now enforces high-risk isolation for private kinds (seed/ssh/pgp/nostr/managed_account) using policy + session state.
- Policy parsing hardening in
agent_export_policy:load_export_policynow parsessecret_isolationblock (enabled/high_risk_kinds/unlock_ttl_sec) for API-side decisions,- policy stamp includes secret isolation fields.
- Added API regression test for private entry retrieval isolation:
- blocked while high-risk locked,
- allowed after
/api/v1/high-risk/unlock.
- Re-verified key targeted suites after changes:
src/tests/test_api_new_endpoints.py(47 passed)src/tests/test_typer_cli.py+src/tests/test_cli_agent_mode.py(78 passed combined)
- Continued Item 8 with explicit class-partition metadata and deeper service-layer enforcement.
- Added partition metadata defaults + helpers in
ConfigManager:secret_class_partitionsdefault includesstandardandhigh_riskclasses,- helper methods for reading/updating partition metadata and unlock state.
- API high-risk unlock/lock endpoints now persist partition unlock state (best-effort) via config manager.
- Added retrieval-layer isolation enforcement in API:
/api/v1/entry/{id}checks entry kind and denies withpolicy_deny:high_risk_lockedfor private kinds when high-risk session is locked.
- Added regression test for API retrieval gating:
- private entry blocked while locked,
- allowed after high-risk unlock.
- Re-ran targeted suites successfully:
src/tests/test_api_new_endpoints.py+src/tests/test_typer_cli.py+src/tests/test_cli_agent_mode.py(125 passed combined)src/tests/test_core_api_services.py+src/tests/test_password_change.py+src/tests/test_kdf_strength_slider.py(55 passed combined)
- Strengthened Item 8 isolation model from hash-check to cryptographic partition-key envelope.
- Updated
agent_secret_isolation:- high-risk factor setup now generates a random partition key and stores it wrapped in
agent_high_risk_partition.key.enc.jsonusing factor-derived key (PBKDF2-SHA256 + Fernet envelope). verify_high_risk_factornow validates by decrypting envelope (legacy hash fallback retained if envelope absent).- Added
unwrap_high_risk_partition_key,partition_key_tag_for_factor, and session storage ofpartition_key_tagon unlock grants.
- high-risk factor setup now generates a random partition key and stores it wrapped in
- Updated unlock flows to require envelope unwrap success before granting session:
- CLI
agent high-risk-unlockcomputes/stores partition key tag. - API
/api/v1/high-risk/unlockcomputes/stores partition key tag.
- CLI
- Existing policy/session isolation enforcement remains in place; now backed by cryptographic factor proof rather than plain hash compare.
- Verified suites after envelope change:
src/tests/test_cli_agent_mode.py+src/tests/test_api_new_endpoints.py(79 passed combined)src/tests/test_typer_cli.py(46 passed)src/tests/test_core_api_services.py+src/tests/test_password_change.py+src/tests/test_kdf_strength_slider.py(55 passed combined)
Memory Update — secret-isolation-partition-migration-v1 — 2026-03-01
Key findings
- Added an encrypted high-risk partition store (
src/seedpass/core/high_risk_partition_store.py) that migrates private/high-risk entries out of the primary index intoseedpass_high_risk_entries.json.encand leaves deterministic stubs in index. - High-risk factor handling now supports a wrapped partition key envelope (
agent_high_risk_partition.key.enc.json) so unlock sessions can carry a partition key tag for partition reads. agent lease-consumeneeded explicit partition hydration for private kinds; without this, partitioned entries could fail downstream secret resolution.
Patterns / reusable knowledge
- Keep partition access behind existing high-risk unlock checks and session TTLs; use the unlock session as the only source of partition key tag context.
- Add command-level migration (
agent high-risk-partition-migrate) before enforcing partition-only retrieval to keep rollout safe for existing profiles. - Regression tests for partition flows are most reliable in
src/tests/test_cli_agent_mode.pyby monkeypatching hydration and migration seams.
Warnings / gotchas
- Any path that reads private entries by index must hydrate
partition=high_riskstubs before attempting kind-specific secret derivation. - API/CLI behavior can diverge if one retrieval path is updated without the other; keep partition rules centralized where possible.
- Added API parity for partition hydration in
GET /api/v1/entry/{id}sopartition=high_riskstubs are resolved via unlock-session key tag before response. - Added API regression
test_get_entry_hydrates_partitioned_high_risk_entryto lock this behavior.
Memory Update — automation-primitives-v1 — 2026-03-01
Key findings
- Added
agent job-runas a schedule-safe wrapper overagent getwith safe broker defaults (keyring/command) and explicit denial forenvbroker unless--allow-env-brokeris passed. - Added
agent job-templateto generate deterministic cron/systemd snippets that avoid plaintext password env requirements and encode brokered auth usage. - Tightened token validation so legacy tokens without
identity_idare denied at use time withtoken_identity_missing.
Patterns / reusable knowledge
- Reusing
ctx.invoke(agent_get, ...)keeps policy, redaction, approval, leases, and auditing semantics consistent across interactive and automated retrieval paths. - Expose automation controls in both bootstrap-context command maps and capabilities output to keep discovery parity for autonomous agents.
Warnings / gotchas
- Existing legacy tokens with empty
identity_idnow fail; rotate/reissue withagent token-issue --identity-id ...before enabling strict automation workflows.
Memory Update — automation-job-profiles-v1 — 2026-03-01
Key findings
- Added persistent automation job profiles in
src/seedpass/core/agent_job.pywith create/list/get/revoke lifecycle and 0600 on-disk storage. - Added agent CLI commands:
job-profile-create,job-profile-list,job-profile-run, andjob-profile-revoketo support reusable scheduled workflows with policy-binding metadata. job-profile-runnow executes throughagent job-run, preserving existing policy/redaction/approval semantics while enforcing fingerprint binding.
Patterns / reusable knowledge
- For safer automation rollout, keep reusable job metadata separate from token/secret material and route execution through existing guarded retrieval commands.
- Include automation profile capabilities in both
bootstrap-contextandcapabilitiesoutput so agents can discover the full control surface deterministically.
Warnings / gotchas
job-profile-runenforces fingerprint match; invoking with a different--fingerprintintentionally denies.- Command-broker job profiles must include
--broker-commandat creation time. - Item 10 hardening continued with job profile policy/host guardrails.
agent job-profile-createnow storespolicy_stamp(from current normalized policy) andhost_binding(default current hostname).agent job-profile-runnow denies by default on:job_profile_policy_mismatch(active policy stamp drift)job_profile_host_mismatch(host binding mismatch) with explicit override flags--allow-policy-driftand--allow-host-mismatch.
- Added
agent job-profile-checkcommand for profile posture checks (unsafe broker, policy drift, host mismatch, staleness) with optional strict exit. - Updated capabilities/bootstrapped command maps to include
job-profile-checkand automation guardrail metadata. - Added regression tests for policy mismatch, host mismatch, and profile check drift findings.
- Added API parity for automation job profiles (Item 10) in
src/seedpass/api.py:GET/POST /api/v1/agent/job-profilesDELETE /api/v1/agent/job-profiles/{job_id}POST /api/v1/agent/job-profiles/{job_id}/runGET /api/v1/agent/job-profiles/check
- API run endpoint enforces profile fingerprint binding, policy-stamp drift checks, and host-binding checks with explicit override flags, and issues secret leases for matched resources.
- Capabilities discovery now includes new API job-profile endpoints.
- Added API regression tests for CRUD and run behavior (including policy drift denial + override).
- Added API template rendering endpoint for job profiles:
GET /api/v1/agent/job-profiles/{job_id}/templatewith deterministiccronandsystemdoutput modes. - Endpoint supports profile/default/provided schedule resolution and returns command + rendered template payload for orchestration tooling.
- Added API regression coverage for cron and systemd template outputs.
- Updated capabilities API discovery list to include the new template endpoint.
- Added API template authoring + integrity workflows for automation jobs:
POST /api/v1/agent/job-profiles/{job_id}/template(richer template input)POST /api/v1/agent/job-profiles/{job_id}/template/verify(manifest verification)
- Added signed template manifests (HMAC-SHA256) including template hash, policy stamp, host binding, and job profile id.
- Added deterministic template helpers shared by GET/POST template endpoints.
- Updated capabilities metadata/discovery with API template + verify endpoints and automation manifest-signing capability.
Memory Update — recovery-hardening-v1 — 2026-03-01
Key findings
- Added deterministic Shamir split/recover primitives in
src/seedpass/core/agent_recovery.py(split_secret,recover_secret) with share token checksums. - Added signed backup verification drill logging (
record_recovery_drill,list_recovery_drills) with chained HMAC signatures. - Exposed recovery workflows in agent CLI:
agent recovery-splitagent recovery-recoveragent recovery-drillagent recovery-drill-list
Patterns / reusable knowledge
- Recovery commands should default to non-revealing output and require explicit
--revealfor plaintext recovery output. - Drill reporting should be append-only and signed so verification history remains tamper-evident.
Warnings / gotchas
- Current split derivation is deterministic by design for reproducibility; rotating labels should be treated as distinct recovery sets.
- Added Item 11 API parity for recovery workflows:
POST /api/v1/agent/recovery/splitPOST /api/v1/agent/recovery/recoverPOST /api/v1/agent/recovery/drillGET /api/v1/agent/recovery/drillsPOST /api/v1/agent/recovery/drills/verify
- Added drill-chain verification primitive in
agent_recovery.verify_recovery_drillsto detect tampering via chained HMAC signatures. - Updated capabilities discovery to include new recovery API endpoints.
- Added API tests for split/recover roundtrip, drill list/verify, and tamper detection.
Memory Update — conflict-safe-sync-v1 — 2026-03-01
Key findings
- Introduced deterministic merge primitive
merge_index_payloadsinsrc/seedpass/core/sync_conflict.py. - Conflict resolver now uses order-independent comparison:
- higher
modified_ts - on tie, lexicographically larger canonical entry hash.
- higher
- Integrated merge primitive into Nostr merge path (
EncryptionManager.decrypt_and_save_index_from_nostr(..., merge=True)). - Added encrypted sync metadata
_sync_metainto index payload to track merge strategy and source tags.
Patterns / reusable knowledge
- Keep merge logic centralized and deterministic to avoid divergent state from different delta arrival orders.
- Use payload-derived source tags + bounded source history in encrypted index metadata for debugging merge provenance without plaintext side channels.
Warnings / gotchas
- Existing tests that implicitly relied on "incoming wins on equal timestamp" need explicit timestamp separation if validating LWW semantics.
- Extended Item 12 conflict-safe sync with deterministic field-level merge rules for equal-timestamp conflicts in
sync_conflict.merge_index_payloads. - Equal-ts conflicts now perform deterministic winner selection by hash plus selective field union (
username/url/notes/...) and conservative archive OR behavior. - Added order-independence regression tests covering both whole-entry tie resolution and field-level union behavior.
- Integrated resolver in
EncryptionManager.decrypt_and_save_index_from_nostr(..., merge=True)with source-tagged encrypted sync metadata.
2026-03-01 - Sync conflict v2 tombstones
- Added deterministic sync strategy
modified_ts_hash_tombstone_v2insrc/seedpass/core/sync_conflict.py. - Added
_sync_meta.tombstonesmerge semantics with timestamp-first then event-hash tie-break, and retention cap. - Added kind-aware equal-timestamp unions (including deterministic
tags/custom_fieldsunion). EntryManager.delete_entrynow emits local tombstones before removing entries so deletions can propagate across merge-based sync.- Regression coverage added in
src/tests/test_delta_merge.pyfor order-independence, kind-aware unions, and tombstone convergence. - Validation run:
src/tests/test_delta_merge.py(7 passed), plussrc/tests/test_profile_management.py src/tests/test_api.py src/tests/test_api_new_endpoints.py(83 passed).
2026-03-01 - CLI discoverability refresh for agents/users
- Updated root CLI help in
src/seedpass/cli/__init__.pyto direct users/agents toseedpass capabilitiesand subgroup--help. - Updated vault unlock success tip in
src/seedpass/cli/vault.pyto explicitly mentionseedpass capabilitiesafter unlock/login. - Expanded
src/seedpass/cli/capabilities.pymap with:security_features.sync(deterministic conflict strategymodified_ts_hash_tombstone_v2+ tombstones metadata)export_controlscommands and defaultsposturecommand/check descriptions- richer approval coverage and help hints (including post-login guidance)
- Updated agent discoverability surfaces in
src/seedpass/cli/agent.py:- richer group help text
agent initnow returnsnext_stepsincluding capabilities/bootstrap discoveryagent bootstrap-contextnow advertises export/posture command groups
- Validation:
src/tests/test_typer_cli.py+src/tests/test_cli_agent_mode.pypassed (92 passed).
2026-03-01 - Sync replay/idempotency hardening
- Hardened
src/seedpass/core/sync_conflict.pyto remove wall-clock dependence from merge metadata:last_merge_tsnow derived deterministically from existing/incoming metadata and max observed entry/tombstone timestamps.- deleted-entry fallback tombstone timestamp now derived from merge state, not
time.time().
- Added integer normalization helper for metadata parsing (
_safe_int) and centralized max timestamp helpers. - Added replay-focused tests in
src/tests/test_delta_merge.py:- idempotent replay of same payload (
once == twice) - stale payload cannot override newer state
- stale re-add cannot resurrect tombstoned entry
- newer recreate supersedes tombstone and clears it
- idempotent replay of same payload (
- Validation:
src/tests/test_delta_merge.py(11 passed) + broader regression set (test_profile_management.py,test_api.py,test_api_new_endpoints.py) (83 passed). - Added vault-boundary idempotency regression in
src/tests/test_delta_merge.py::test_merge_replay_idempotent_through_vault_boundaryby replaying same merged encrypted payload twice after baseline sync.
2026-03-01 - Item 12 docs/contract pass
- Added
docs/sync_conflict_contract.mddocumenting deterministic merge strategymodified_ts_hash_tombstone_v2,_sync_metaschema, tombstone semantics, replay guarantees, and retention behavior. - Linked contract doc from
docs/SPEC.md,docs/nostr_setup.md, anddocs/README.md. - Added
test_merge_last_merge_ts_order_independentinsrc/tests/test_delta_merge.pyto lock deterministic metadata ordering behavior. - Validation:
src/tests/test_delta_merge.py(13 passed) and targeted CLI discoverability checks (2 passed).
2026-03-01 - Item 13 policy-as-code workflow primitives
- Extended agent policy CLI in
src/seedpass/cli/agent.py:agent policy-lint --file <path> [--format json|text]with deterministicpolicy_stampand fullpolicy_hash.agent policy-review --file <path>with deterministic unified diff, structureddiff_summary, and risky finding surfacing.agent policy-apply --file <path>with--dry-runand risk gate (--allow-risky) plus audit eventagent_policy_applied.
- Added helper functions for file-based policy normalization, full-hash computation, and rule-level change summary.
- Updated discovery surfaces:
- capabilities policy commands now include review/apply and policy-as-code support flags.
- bootstrap context now includes
agent policy-reviewandagent policy-apply.
- Added tests:
test_agent_policy_lint_filetest_agent_policy_review_and_apply_risk_gate- bootstrap context expectations for new policy commands
- capabilities JSON assertion for policy change-review support.
- Added docs:
docs/policy_as_code.mdand linked fromdocs/README.md. - Validation:
src/tests/test_cli_agent_mode.py+src/tests/test_typer_cli.pypassed (94 passed).
2026-03-01 - Item 14 deterministic export controls hardening
- Hardened
src/seedpass/core/agent_export_policy.pypolicy-filtered manifest verification:- manifest version advanced to v2 (with backward-compat support for v1)
- deterministic index sorting helper for mixed/non-numeric indexes
- added
entries_sha256integrity field (canonical hash of filtered entries) - added checks for included count, schema version consistency, redacted fields consistency, entry-kind allowlist conformance, and redaction sentinel conformance
- robust integer parsing to avoid verifier crashes on malformed manifests
- Added tamper-detection tests:
- CLI:
test_agent_export_manifest_verify_detects_tampered_entries - API:
test_export_manifest_verify_endpoint_detects_tamper
- CLI:
- Updated capabilities map to surface manifest entry hash verification support.
- Updated docs (
docs/policy_as_code.md) to document deterministic manifest integrity fields and tamper verification. - Validation:
src/tests/test_cli_agent_mode.py src/tests/test_typer_cli.py src/tests/test_api_new_endpoints.py=> 152 passed.
2026-03-01 - Item 15 posture tooling expansion
- Expanded
agent posture-checkfindings insrc/seedpass/cli/agent.pywith additional controls:approvals_missing_required_actions(export/reveal_parent_seed/private_key_retrieval gate completeness)high_risk_unlock_ttl_too_long(>1800s)over_permissive_read_rule(broad secret-read allow rule detection)private_read_without_approval_gate(private-kind reads without private key approval gate)identity_rotation_window_too_long(rotation_days > 90)token_rotation_overdue(active token age exceeds bound identity rotation_days)
- Updated capabilities posture checklist in
src/seedpass/cli/capabilities.pyto reflect new checks. - Added posture regression tests in
src/tests/test_cli_agent_mode.py:test_agent_posture_check_flags_policy_gate_and_rule_issuestest_agent_posture_check_flags_token_rotation_overdue
- Validation:
src/tests/test_cli_agent_mode.py src/tests/test_typer_cli.py(97 passed) andsrc/tests/test_api_new_endpoints.py(57 passed).
2026-03-01 - Item 15 runtime config posture checks
- Extended
agent posture-checkinsrc/seedpass/cli/agent.pywith opt-in runtime config audit:- new flag
--check-runtime-configwith broker options (--auth-broker,--password-env,--broker-service,--broker-account,--broker-command) - requires
--fingerprintwhen runtime check is requested - runtime summary fields:
runtime_config_status,runtime_config_error,runtime_finding_count
- new flag
- Added runtime findings:
quick_unlock_enabledweak_kdf_iterationshigh_risk_partition_persistently_unlocked
- Added additional posture checks in this pass:
approvals_missing_required_actionshigh_risk_unlock_ttl_too_longover_permissive_read_ruleprivate_read_without_approval_gateidentity_rotation_window_too_longtoken_rotation_overdue
- Updated capabilities posture check list to include runtime config drift checks.
- Added/updated tests in
src/tests/test_cli_agent_mode.pyfor new posture findings and runtime-check behavior. - Validation:
src/tests/test_cli_agent_mode.py src/tests/test_typer_cli.py src/tests/test_api_new_endpoints.py=> 156 passed.
2026-03-01 - Item 15 remediation bundle command
- Added
agent posture-remediateinsrc/seedpass/cli/agent.pyto convert current posture findings into deterministic actionable remediation steps. - Command supports
--check-runtime-configwith broker auth options and mirrors runtime drift checks used by posture-check. - Added remediation mapping for key findings (policy gates, export controls, safe output, isolation, token hygiene, rotation, runtime config drift).
- Updated discovery:
- bootstrap context posture commands now include
agent posture-remediate - capabilities posture command list includes remediation command
- text capabilities summary mentions remediation bundles
- bootstrap context posture commands now include
- Added tests:
test_agent_posture_remediate_emits_actionstest_agent_posture_remediate_runtime_requires_fingerprint- bootstrap context posture command assertion
- capabilities JSON posture command assertion
- Validation:
src/tests/test_cli_agent_mode.py src/tests/test_typer_cli.py src/tests/test_api_new_endpoints.py=> 158 passed.
2026-03-01 - Docs and landing updates for agent/user discoverability
- Updated root
README.mdwith a dedicated Agent and Automation Security Features section covering implemented controls and command references (capabilities, policy, tokens, leases, approvals, isolation, automation jobs, recovery, export controls, posture tooling, audit logging). - Updated
docs/README.mdto include agent/autonomy docs and explicit discoverability commands (seedpass --help, group help,capabilities,agent bootstrap-context). - Expanded
docs/security.mdwith current agent security controls and links to core plan/contract docs. - Updated
docs/security_readiness_checklist.mdwith a new Agent Autonomy Control Track (15-item plan) status table and evidence pointers. - Updated
docs/agent_autonomy_security_plan.mdwith a dated implementation snapshot (implemented vs in-progress). - Updated website docs index in
landing/docs.htmlto includesecurity_readiness_checklist.md,agent_autonomy_security_plan.md,policy_as_code.md, andsync_conflict_contract.md. - Added a new For Agents section to
landing/index.html(with nav anchor) and supporting styles inlanding/style.css, including quickstart command and agent-specific feature cards.