# Harvester Memory Sync

> Sync trend-harvester analyzed output to P2-hippocampus memories — bidirectional bridge between P4-cortex growth engine and P2-hippocampus long-term memory

- **Type:** Skill
- **Install:** `agentstack add skill-humanerd-drew-opencode-drewgent-harvester-memory-sync`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [humanerd-drew](https://agentstack.voostack.com/s/humanerd-drew)
- **Installs:** 0
- **Category:** [Agent Skills](https://agentstack.voostack.com/c/agent-skills)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [humanerd-drew](https://github.com/humanerd-drew)
- **Source:** https://github.com/humanerd-drew/opencode-drewgent/tree/main/@action/skills/brain/harvester-memory-sync

## Install

```sh
agentstack add skill-humanerd-drew-opencode-drewgent-harvester-memory-sync
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# Harvester Memory Sync — P4→P2 Bridge

## Purpose

Sync trend-harvester's analyzed trends to P2-hippocampus long-term memory.
Keeps P2-hippocampus/memories/insights/ in sync with P4-cortex/growth/trend-harvester/ analyzed output.

This closes the P4→P2 downstream flow: trend-harvester output must reach
P2-hippocampus/memories/ so the full memory layer benefits from growth insights.

## Trigger

- **Primary**: Run automatically after trend-harvester-001 job completes
- **Fallback**: Run on-demand via `python3 scripts/harvester_memory_sync.py`

## Data Flow

```
P4-cortex/growth/trend-harvester/
  collected/     ← raw data (NOT synced)
  analyzed/      ← scored trends → COPY to P2 memories
    keep/        ← score ≥ 6.0 → insights/YYYY-MM.md
    review/      ← 4.0 ≤ score < 6.0 → insights/pending/
    graveyard/   ← NOT synced
  pending/       ← approved trends → concepts/
  applied/       ← applied trends → concepts/ + notes

P2-hippocampus/memories/
  insights/      ← trend insights (by date)
  concepts/      ← applied concept files
```

## Sync Rules

| Source (P4) | Destination (P2) | Action |
|---|---|---|
| `analyzed/keep/*.json` | `insights/YYYY-MM.md` | Append to monthly insight |
| `analyzed/review/*.json` | `insights/pending/` | Create pending insight file |
| `analyzed/graveyard/*.json` | — | Skip (no sync) |
| `pending/*.json` | `concepts/` | Create/update concept file |
| `applied/*.json` | `concepts/` | Create/update concept + tag `trend-applied` |

## Anti-Duplication

- Use content hash (MD5 of trend URL or description) as dedup key
- Check if same hash already exists in target before writing
- Track synced hashes in `drewgent_hidden_state.json["harvester_synced_hashes"]`

## State Tracking

Read/write from `P4-cortex/knowledge/drewgent_hidden_state.json`:

```json
{
  "harvester_synced_hashes": ["hash1", "hash2"],
  "last_sync_at": "2026-05-12T10:00:00+09:00",
  "last_sync_job": "trend-harvester-001",
  "synced_count": 42
}
```

## Script Usage

```bash
# Manual run
python3 scripts/harvester_memory_sync.py

# Dry run (show what would be synced)
python3 scripts/harvester_memory_sync.py --dry-run
```

## Exit Codes

- `0`: Sync complete, no errors
- `1`: Partial sync (some files failed)
- `2`: No trend-harvester output found (not an error — job may not have run yet)

## Related
- [[@action/skills/SKILL-INDEX]]
- [[@action/skills/brain/DESCRIPTION]]

## Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [humanerd-drew](https://github.com/humanerd-drew)
- **Source:** [humanerd-drew/opencode-drewgent](https://github.com/humanerd-drew/opencode-drewgent)
- **License:** MIT

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/skill-humanerd-drew-opencode-drewgent-harvester-memory-sync
- Seller: https://agentstack.voostack.com/s/humanerd-drew
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
