PromptBase
Upgrade
Close icon
General
Home
Marketplace
Create
Hire
Login
Chat
Sell
Explore

Prompt Details

Model
(claude-5-opus)
Token size
1,314
Example input
[Single Agent / Multi-Agent / AI Copilot / Autonomous Agent]: Multi-Agent Orchestration System (demand forecaster + shipment optimizer + supplier monitor + inventory manager) [Customer Support / Coding / Research / Sales / Operations / Automation]: Real-time shipment route optimization, predictive demand-supply matching, supplier reliability scoring, inventory shortage alerts, last-mile delivery coordination [Vector DB / SQL / APIs / PDFs / Documents / CRM / ERP]: ERP systems (SAP, Oracle), real-time IoT tracking (GPS, temperature sensors), supplier performance databases, historical shipment logs (10+ years), demand forecasts (ML models), carrier APIs, geospatial data (routes, traffic, weather) [GPT / Claude / Gemini / Open Source]: Claude 3.5 Sonnet [ Accuracy Recall Latency Cost User Satisfaction]: 98% on-time delivery prediction accuracy, <120ms exception alert latency, 95% inventory optimization, $13.5K/month cost, 99.8% shipment tracking integrity
Example output
## 🧠 SAMPLE ARCHITECTURE OUTPUT ### 1️⃣ Executive Architecture Overview • **Business Goal:** Reduce supply chain disruptions by 60% through AI-driven predictive analytics, real-time shipment optimization, and autonomous exception handling with complete audit trails for ISO 9001 compliance • **Memory Objectives:** Maintain real-time shipment state (location, condition, ETA), index 10+ years of supplier performance signals, cache demand forecasts with confidence intervals, track inventory levels across 500+ warehouses, version-controlled routing rules linked to carrier SLAs • **Core Challenge:** Balance ultra-low latency (sub-150ms for critical alerts) with massive data volume (50K events/day), maintain perfect shipment auditability, dynamically adapt routing based on live traffic/weather, isolate EU supplier data (GDPR) from global network • **Success Metric:** 98% delivery accuracy, <120ms alert latency, 95% inventory efficiency, $13.5K/month cost, zero audit violations --- ### 2️⃣ Memory Architecture **🔵 Working Memory (Live Operations Session)** • 3KB token budget (Sonnet context for real-time coordination decisions) • Active shipments (top 20 priority exceptions), current weather/traffic conditions, coordinator notes, pending actions • Stored in Kafka topics (event streaming) + Redis (high-speed cache), TTL 2 hours (operational window) • Per-region isolation (EU suppliers separate encryption key from US/APAC) **🟡 Short-Term Memory (Operational Context)** • Last 500 shipment events (24-hour rolling, indexed by shipment_id + coordinator_id) • Event: exception detected, coordinator action taken, outcome (on-time / delayed / rerouted) • Stored in InfluxDB (time-series queries) + DuckDB (analytical aggregations) • Used to detect coordinator patterns: risk-prone routes, preferred carriers, exception handling effectiveness **🟢 Long-Term Memory (Shipment Master Data)** • Complete shipment history: 10+ years of completed shipments with route taken, actual time, cost, carrier performance, customer outcome • Primary: DuckDB (SQL queries on structured data), Secondary: Milvus (embedding-based similarity search for route patterns) • Chunked: shipment metadata (50 tokens) + route-performance details (512-token historical chunks) • Freshness: daily ERP sync (new shipments); real-time updates for in-transit events **🟣 Episodic Memory (Exception Decisions)** • Individual exception events: detection trigger, coordinator decision (reroute, delay, escalate), result (resolved / unresolved), root cause • Stored in Neo4j (relationship graph: shipment → carrier → supplier → customer) + DuckDB (analytics) • Retention: perpetual (audit trail); versioning by decision timestamp + coordinator ID • Query: "Have we handled similar [weather exception + carrier] before?" **🔴 Semantic Memory (Supply Chain Knowledge Base)** • Carrier SLAs (15 major carriers), supplier lead times, warehouse capacity limits, product-route compatibility rules • Source: master agreements (git-versioned), ERP configuration tables, carrier APIs • Format: structured JSON (carrier_id → performance_metrics, capacity, coverage_zones, penalty_clauses) • Embedding: supply chain context embeddings (cost + speed + reliability + footprint) **🟠 Procedural Memory (Exception Handling Rules)** • Decision trees: if (shipment_delay > 2hrs AND alternative_carrier_available AND cost_diff < $50) → recommend reroute • Stored: procedural JSON + rule engine (Drools-compatible); version-controlled in git • Links to SLA clauses: each rule cites which carrier/customer SLA permits this action • Example: "Weather delay + perishables → escalate if ETA miss exceeds 30 min per cold-chain SLA" **🩵 Vector Memory (Operational Intelligence)** • All historical shipments (10M records) chunked by route pattern + summarized → unified vector index in Milvus • Embedding model: logistics-BERT (768-dim) — trained on shipping manifests + delivery notes • Milvus schema: shipment_id, route_hash, origin_zip, dest_zip, carrier, product_type, date, performance_vector • Namespace per product type (perishable, fragile, hazmat) for isolated pattern matching • Re-rank: semantic route similarity + carrier track record + current capacity + traffic prediction **🟦 Shared Team Memory (Coordination Hub)** • Live exception board: "Weather disruption in Northeast — 47 shipments affected" (Kafka topic + Redis sorted set) • Shared inventory view: real-time stock across all warehouses by SKU (Neo4j supply graph + Redis) • Carrier alerts: capacity utilization, delay trends, equipment breakdowns (pub/sub topics) • TTL: live for exception board (expires when resolved); perpetual for inventory; 30 days for alert trends --- ### 3️⃣ Memory Lifecycle **🟢 Creation** • Order placed in ERP → shipment created → metadata extracted (origin, destination, weight, deadline) • Route optimization triggered: query Milvus for similar historical routes + current carrier capacity • Real-time tracking initialized: GPS/IoT sensor stream ingested into InfluxDB • Session snapshot: store initial route + baseline ETA (reproducible for post-delivery analysis) **🟡 Storage** • Working: Redis (shipment_{shipment_id}, cache top-100 exceptions) • Short-term: InfluxDB (time-series events), DuckDB (analytical aggregates) • Long-term: DuckDB (shipment master table, 10M rows) + Milvus (route pattern embeddings) • Exception trail: Neo4j (relationship graph: shipment → decisions → outcomes) **🔵 Updating** • Real-time: GPS location streamed into InfluxDB every 30 seconds (Kafka → time-series ingestion) • Hourly: demand forecast refreshed (ML model retrained on latest orders) • Daily: ERP sync (completed shipments moved to archive; new shipments indexed) • Carrier performance: updated on delivery confirmation (on-time ratio, damage rate, SLA compliance) **🟣 Expiration** • Working memory: auto-delete after 2 hours (operational session window) • Short-term: retain 24 hours, then compress into hourly summary (JSON: "45 on-time, 3 delayed, 2 rerouted") • Long-term: never expire (historical shipment data is strategic asset); compress transaction logs after 5 years • Audit hold: if shipment involved customer complaint, flag as immutable (2-year retention minimum) **🟠 Compression** • After shipment in-transit > 12 hours: compress event stream → JSON state snapshot • Example: "Route via Memphis DC, carrier FedEx, ETA +2hrs due to traffic jam I-40" • Reduce token size by 60% while preserving decision context • Store compressed version in DuckDB with link to full event log in Kafka topic retention **🟤 Summarization** • Daily: aggregate coordinator actions → patterns (e.g., "Coordinator Chen resolves weather delays 95% vs. avg 78%") • Weekly: carrier performance report (on-time %, cost/mile, damage rate, SLA compliance) • Monthly: route optimization opportunities (highest-cost routes, frequency of delays, alternative recommendations) **🖤 Archiving** • Completed shipments: move to cold DuckDB (analytical queries only) after 6 months • Retain full event trail in Kafka log; compress real-time sensor data (keep only exception moments) • Enable historical analysis: "Which carriers handled 2022 supply chain crisis best?" • Cost: analytical storage $0.02/GB/month vs. $0.50/GB/month for real-time **⚫ Deletion** • Failed shipment (customer refund): keep full audit trail indefinitely (litigation possible) • Routine completed shipment: delete raw GPS coordinates after 2 years (privacy); keep summary • GDPR request: EU supplier data anonymized from all operational dashboards; retain for audit only • Compliance: immutable deletion logs (timestamp, coordinator, reason, data hash for verification) --- ### 4️⃣ Context Management **📊 Token Budget** • Claude 3.5 Sonnet: 200K context window • Allocation: 3K working memory + 30K shipment context (active + historical) + 50K carrier/supplier data + 80K reasoning • Reserve 37K for decision justification + audit trail documentation **🎯 Context Compression** • Shipment summary: "Order #12345: NYC→LA, 2K lbs electronics, FedEx, ETA 48h, on-track" (25 tokens vs. 1.5K for full event log) • Carrier context: JSON of current capacity + SLA metrics only (40 tokens vs. 2K for full performance history) • Result: 85% token reduction without accuracy loss **⏪ Sliding Window** • Maintain last 15 coordinator actions in active context (2–3K tokens typical) • Older actions: extract decision rationale → store in exception case study (JSON) • Refresh window every 2 turns (faster than advisory use cases; logistics is real-time) **🔄 Session Continuity** • Coordinator handoff (shift A → B): export current exception board + pending actions + recent trends • New coordinator sees: critical shipments, flagged risks, actions in progress, recent coordinator decisions • Zero context loss; new coordinator can take immediate action or escalate **🔃 Context Refresh** • Every 2 turns: fetch live traffic data (Google Maps API) + weather forecast for all in-transit shipments • Detect contradictions: flag if ETA has slipped >30 min from last forecast (update routing options) • Update real-time memory automatically; alert coordinator if major change (>2hr ETA miss) --- ### 5️⃣ Retrieval Strategy **🔍 Embedding Pipeline** • Input: coordinator query (e.g., "fragile electronics NYC→LA during holiday season best carrier?") → logistics-BERT embedding (768-dim) • Async: Kafka job indexes historical routes; parallel extraction of seasonal patterns + carrier specializations • Latency target: <100ms for embedding (logistics-BERT optimized for fast inference) **🎲 Similarity Search** • Milvus query: top-k=20 similar historical shipments (cosine distance on logistics-BERT embeddings) • Filters: product_type = electronics, origin_zip matches NYC region, dest_zip matches LA region, holiday season (date range) • Re-rank by carrier success rate (FedEx vs. UPS vs. DHL) + cost efficiency + recency (recent routes weighted 3x) **🔀 Hybrid Search** • Parallel: route-based retrieval (zip code matching) + semantic search (route pattern embeddings) • Combine: 0.4 × zip_match_score + 0.6 × semantic_score • Example: "fragile electronics" retrieves exact product matches (zip search) + semantically similar high-care shipments (embeddings) **🏷️ Metadata Filtering** • Query metadata: product_type (electronics, perishable, hazmat), origin_zip, dest_zip, deadline, carrier_preference • Pre-filter Milvus: only shipments matching product type + similar route (hard filter) • Result: reduces candidate set from 10M to 10K before semantic re-ranking **🎖️ Ranking** • Primary: semantic route similarity (logistics-BERT distance) • Secondary: carrier on-time performance (% on-time deliveries for similar routes) • Tertiary: cost efficiency (cost per mile for successful shipments) • Quaternary: recency (routes from last 3 months ranked higher; seasonal patterns matter) • Quaternary+: coordinator history (if Coordinator Smith frequently uses Carrier X, boost X's similar routes) **🔁 Re-ranking** • Claude cross-encoder: "Rate 1–5 suitability of this [carrier + route] for current shipment" • Verify SLA compliance: "Does this carrier's SLA cover current deadline + product type?" • Flag risks: "Is there known congestion on this route during current date?" • Result: top result moves from rank-8 to rank-1 if better fit than initial ranking **💾 Caching** • Redis cache: top-500 route queries ("NYC→LA fragile", "perishables same-day", "hazmat West Coast") • TTL: 6 hours (routes change based on time of day + weather) • Invalidate on: major weather event, carrier capacity alert, traffic jam detection • Hit rate: 48% on route queries (common lane pairs repeat frequently) **✅ Retrieval Validation** • Post-retrieval: Claude checks "Is this route still valid (no weather, carrier not at capacity)?" • Verify SLA: "Confirm recommended carrier meets customer deadline + product requirements" • Flag risks: "Alert if route has historical delay rate >15% during current hour/day" • Metric: route recommendation accuracy = 96%+ (must be reliable for SLA compliance) --- ### 6️⃣ Knowledge Engineering **📚 Knowledge Sources** • ERP systems: 10M completed shipments (10+ years); 5K new shipments daily • Real-time IoT: 50K active trackers (GPS, temperature, humidity, impact sensors) • Carrier APIs: live capacity, pricing, performance data for 15 major carriers • Historical logs: 10 years of routes, delays, costs, damage reports • Weather data: real-time + forecast (OpenWeather API, NOAA) for route-specific conditions • Demand forecasts: ML models predicting orders by SKU (updated daily) • Sync: real-time for IoT/weather/APIs, daily for ERP, weekly for demand forecasts **✂️ Document Chunking** • Strategy: semantic chunking on shipment events (loading → in-transit → delivery) • Target size: shipment metadata (150 tokens), route performance summary (512-token chunks with route segments) • Overlap: 100 tokens between chunks (preserve handoff points: depot → transit → final delivery) • Hierarchy: preserve shipment lifecycle (order → fulfillment → delivery) for navigability **🏷️ Metadata Design** • Core: shipment_id, order_id, origin_zip, dest_zip, carrier, date, product_sku, weight, volume • Performance: actual_delivery_date, actual_cost, on_time_indicator, damage_occurred, exception_count • Quality: weather_conditions, traffic_level, carrier_capacity_used, sla_compliance, coordinator_notes • Custom: coordinator_difficulty_score (0–1, ML prediction of complexity); route_risk_flags [] **🔄 Knowledge Freshness** • ERP sync: daily incremental (new shipments + completed shipments) • Real-time data: 30-second refresh for active trackers; 1-hour refresh for weather • Staleness detection: flag routes >6 months old as "seasonal pattern only" (may not apply year-round) • Contradictions: if carrier reports delivery success but tracking shows stuck location, flag for investigation **📝 Version Control** • Git repo: shipment event logs stored as Parquet + JSON metadata • Branches: staging (pre-archive), production (live analytical queries) • Changelog: every significant change (carrier SLA update, warehouse closure, new product type) • Rollback: revert to last known-good routing rules if quality metric drops **⚖️ Conflict Resolution** • Contradictions detected: ERP says "delivered on-time", customer says "arrived 2 days late" • Resolution: check actual tracking timestamp vs. customer expectation; identify SLA gap • Alert: "Delivery timing discrepancy — investigate customer vs. carrier timeline" • Audit: log all conflicts; coordinator must review + document cause (weather, traffic, customer error) --- ### 7️⃣ Performance Optimization **⚡ Latency (Target: <150ms for critical alerts)** • Embedding: <50ms (logistics-BERT inference on GPU) • Milvus retrieval: <60ms (pre-filtered by product type + route) • Claude inference: <30ms (streaming + structured output) • Network overhead: <10ms (local Kafka + Redis, no external API calls for hot path) **🏎️ Retrieval Speed** • Milvus indexing: HNSW algorithm with product_type pre-filtering (reduces search space 99%) • Query optimization: filter by product type before similarity search • Caching: Redis LRU for top-500 route queries (hit rate: 48%) • Parallel retrieval: query carrier capacity + weather forecast + route history simultaneously • Result: median 55ms retrieval (p95: 120ms) **💰 Embedding Cost** • Model: logistics-BERT (smaller; ~$0.001 per 1M tokens) • Batch processing: embed new shipments + historical routes daily (off-peak) • Selective re-embedding: only update when shipment enters new geographic zone • Cost: ~$120/month for 50K shipments/day + historical analysis **📊 Token Usage** • Context compression: reduce from 30K → 4K tokens per coordination session (87% savings) • Structured queries: JSON schema for route/carrier/product params (15% fewer tokens) • Incremental retrieval: only fetch top-3 best routes (vs. top-10) • Result: 60% fewer tokens vs. naive retrieval **💾 Cache Strategy** • L1 (Redis): top-500 route queries (6-hour TTL, invalidate on weather/traffic alerts) • L2 (InfluxDB materialized views): pre-computed hourly carrier capacity snapshots • L3 (DuckDB): weekly route cost aggregates by corridor • Hit rate: 48% on route queries, 70% on carrier metrics, 85% on historical cost lookups **📈 Scalability** • Horizontal: Kafka topic partitioning by shipment region (Americas / EMEA / APAC) • Vertical: InfluxDB time-series optimization (downsampling after 30 days) • Sharding: Milvus vector index by product type (separate index per category) • Roadmap: migrate to Kubernetes autoscaling + Milvus distributed at 200K shipments/day --- ### 8️⃣ Security & Governance **🔐 Access Control** • Role-based: coordinator (read shipment + suggest actions), manager (approve exceptions), admin (audit) • Regional isolation: EU coordinators cannot access APAC shipment data (GDPR) • Carrier isolation: carrier data accessible only to authorized coordinators • API keys: rotated every 45 days; audit all ERP/carrier API access • MFA: enforced for production access + exception overrides **🔒 Encryption** • In-transit: TLS 1.3 for Kafka, ERP APIs, Carrier APIs, real-time data streams • At-rest: AES-256 for DuckDB (shipment master data); separate keys per region (EU / US) • Key management: AWS KMS; rotation every 60 days • Sensitive fields: customer names encrypted; coordinator decisions digitally signed **🛡️ Privacy** • Data residency: EU shipment data stays in eu-central-1 (GDPR requirement) • PII handling: customer addresses masked in analytics; keep only zip codes + coords for routing • De-identification: coordinator dashboards use anonymized aggregates (no customer names) • Consent: supplier opt-out from performance analytics (if desired) **⚖️ Compliance** • ISO 9001: process documentation + audit trail for all shipments; zero lost shipments • GDPR: EU supplier data isolated + separate encryption; deletion on request • Data governance: all shipment data classified (public / internal / confidential) • Audit ready: immutable decision trail (coordinator action + justification + outcome) **📋 Audit Logs** • Immutable audit trail: every shipment event, coordinator action, exception decision logged • DuckDB: audit table (timestamp, coordinator_id, shipment_id, action, outcome, cost_impact) • Alert system: flag unusual patterns (coordinator overrides 50% of suggestions = quality gap) • Retention: perpetual for shipments; 7-year minimum for audit compliance **🧱 Memory Isolation** • Coordinator A (Americas) cannot see Coordinator B (EMEA) shipments • Supplier data: isolated by supplier_id; separate encryption key per supplier • Customer data: anonymized in analytics; identifiable data encrypted separately • Cross-region learning: anonymized patterns only ("routes via Memphis have 8% better on-time") **🗑️ Data Retention** • Active shipment: retain full tracking + decision history for 2 years (customer disputes, audits) • Completed shipment: compress after 6 months (keep summary); archive full data • GDPR request: delete customer PII within 30 days; keep anonymized shipment for analytics • Regulatory hold: all exception decisions retained indefinitely (ISO 9001 requirement) --- ### 9️⃣ Risk Assessment **⚠️ Memory Drift** • Risk: outdated carrier SLA → coordinator approves routing that violates updated terms • Mitigation: weekly SLA sync from carrier APIs; version control + coordinator sign-off on changes • Monitoring: flag decisions that contradict current SLA; enforce re-training quarterly **🎯 Hallucination** • Risk: agent suggests carrier that is offline/bankrupt → coordinator books impossible shipment • Mitigation: real-time carrier status verification (API check); alert on capacity constraints • Monitoring: measure routing success rate (booked routes that execute) = 99%+ **📅 Stale Knowledge** • Risk: coordinator relies on 6-month-old route data; doesn't know about new highway closure • Mitigation: real-time traffic/construction data integration; weekly route re-optimization • Monitoring: track age of cited routes; alert if top-3 suggestions are >2 weeks old **📦 Duplicate Memories** • Risk: same route indexed 3 ways (NYC→LA, 10001→90001, JFK→LAX) → redundant results • Mitigation: route canonicalization (zip code ranges); deduplication by origin/dest coordinates • Monitoring: measure unique results (deduplicate by geo-coordinates); aim for 99% unique **❌ Retrieval Failure** • Risk: coordinator queries rare route combination → zero results → manual route planning (slower) • Mitigation: fallback to component approach ("NYC routes" + "LA routes" if no direct match) • Monitoring: track "no results" rate; aim for <3% (must cover most lanes) **⚠️ SLA Violation** • Risk: recommended routing misses customer deadline → late delivery → SLA penalty • Mitigation: automatic deadline validation (alert if ETA > customer deadline); escalation rules • Monitoring: measure SLA compliance rate; alert if <98% (acceptable target) **🚨 Tracking Integrity** • Risk: GPS device malfunction → coordinator thinks shipment is on-time when actually stuck • Mitigation: sensor anomaly detection (flag missing pings); cross-validate with carrier reports • Monitoring: measure tracking data quality (% of shipments with continuous signals) >99% **⚡ Cascade Failure** • Risk: weather delays one region → demand forecast fails → inventory misallocation across all regions • Mitigation: forecast uncertainty quantification; alert on confidence drop; fallback to safety stock • Monitoring: measure forecast accuracy (MAPE) by region; alert if any region drops >10% --- ### 🔟 Enterprise Roadmap **Phase 1: Architecture Design (Weeks 1–3)** • Kafka streaming topology design (event sources + topics) • InfluxDB schema for time-series shipment events • Neo4j supply network graph (carriers, suppliers, warehouses, routes) • Milvus vector index strategy (product type namespaces) • Deliverable: Architecture diagram + compliance assessment (ISO 9001) **Phase 2: Memory Implementation (Weeks 4–12)** • Load historical shipments (10M records) into DuckDB • Real-time GPS tracking → InfluxDB ingestion pipeline • Milvus indexing with logistics-BERT embeddings (route patterns) • Carrier SLA knowledge base + procedural exception rules • Deliverable: Full historical index searchable; real-time tracking live **Phase 3: RAG Integration (Weeks 13–20)** • Hybrid search (zip code + semantic route matching) • Exception detection pipeline (anomaly scoring on real-time events) • Compliance validation (SLA checks before recommending routes) • Re-ranking by carrier reliability + current capacity • Deliverable: Exception alert accuracy >96% **Phase 4: Optimization (Weeks 21–28)** • Latency tuning: target <150ms for critical alerts • Token cost reduction: 60% savings via context compression • Observability: coordinator performance dashboard + route efficiency metrics • Deliverable: <150ms alert latency, <$14K/month cost **Phase 5: Production Monitoring (Weeks 29–32)** • Rollout with 50 coordinators (pilot regions) • Live monitoring: SLA compliance, coordinator adoption, cost savings • ISO 9001 audit preparation + zero-lost-shipment verification • Deliverable: Production system + compliance certification + 90%+ adoption **🎯 KPIs by Phase** | Phase | KPI | Target | Status | | Phase 1 | Architecture approval | Week 3 | — | | Phase 2 | Historical index | 10M shipments | — | | Phase 2 | Retrieval latency | <200ms | — | | Phase 3 | Exception accuracy | >96% | — | | Phase 4 | Alert latency | <150ms | — | | Phase 4 | Cost/shipment | <$0.28 | — | | Phase 5 | SLA compliance | >98% | — | | Phase 5 | On-time delivery | +20% vs. baseline | — | | Phase 5 | Inventory efficiency | +15% reduction | — | | Phase 5 | Audit violations | Zero findings | — | --- **🏁 SAMPLE TEST COMPLETE**
🌀 Claude

Agent Memory System Engineer

Add to Cart
Instant accessInstant access
Usage rightsCommercial use
Money-back guaranteeMoney‑back
By purchasing this prompt, you agree to our terms of service
CLAUDE-5-OPUS
Tested icon
Guide icon
4 examples icon
Free credits icon
Many AI agents struggle with inconsistent responses, forgotten context, repetitive reasoning, and poor long-term learning because they lack a well-designed memory architecture. This prompt transforms AI into a senior Agent Memory System Engineer that designs enterprise-grade memory architectures, including short-term, long-term, episodic, semantic, and vector memory, while optimizing context management, retrieval strategies, and knowledge persistence for scalable AI agents.
...more
Added 2 weeks ago
Report
Browse Marketplace