[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M75KXH4E5RPSW06VPSTX50GF":3,"skill-same:01M75KXH4E5RPSW06VPSTX50GF":45},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":17,"publishedAt":18,"linkOnly":19,"markdownContent":20,"markdownBody":21,"frontMatter":22,"refName":23,"commitSha":24,"skillDirectory":25,"forksCount":26,"repositoryHtmlUrl":27,"repositoryHomepageUrl":6,"ownerHtmlUrl":28,"ownerBlogUrl":6,"ownerDescription":29,"updatedAt":30,"install":31,"resources":44},"01M75KXH4E5RPSW06VPSTX50GF","deep-agents-memory",null,"INVOKE THIS SKILL when your Deep Agent needs memory, persistence, or filesystem access. Covers StateBackend (ephemeral), StoreBackend (persistent), FilesystemMiddleware, and CompositeBackend for routing.","ydf0509\u002Flc-agent","ydf0509","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F26890690?v=4","01M75KX7AQYS5FN6KPSDJAVM43","01M75KX7C61TGAM4RM0M3K4XG6",8,"MIT","https:\u002F\u002Fgithub.com\u002Fydf0509\u002Flc-agent\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Flangchain_skills\u002Fdeep-agents-memory\u002FSKILL.md",[],[],"2026-11-12 13:55:43",false,"---\nname: deep-agents-memory\ndescription: \"INVOKE THIS SKILL when your Deep Agent needs memory, persistence, or filesystem access. Covers StateBackend (ephemeral), StoreBackend (persistent), FilesystemMiddleware, and CompositeBackend for routing.\"\n---\n\n\u003Coverview>\nDeep Agents use pluggable backends for file operations and memory:\n\n**Short-term (StateBackend)**: Persists within a single thread, lost when thread ends\n**Long-term (StoreBackend)**: Persists across threads and sessions\n**Hybrid (CompositeBackend)**: Route different paths to different backends\n\nFilesystemMiddleware provides tools: `ls`, `read_file`, `write_file`, `edit_file`, `glob`, `grep`\n\u003C\u002Foverview>\n\n\u003Cbackend-selection>\n\n| Use Case | Backend | Why |\n|----------|---------|-----|\n| Temporary working files | StateBackend | Default, no setup |\n| Local development CLI | FilesystemBackend | Direct disk access |\n| Cross-session memory | StoreBackend | Persists across threads |\n| Hybrid storage | CompositeBackend | Mix ephemeral + persistent |\n\n\u003C\u002Fbackend-selection>\n\n\u003Cex-default-state-backend>\n\u003Cpython>\nDefault StateBackend stores files ephemerally within a thread.\n\n```python\nfrom deepagents import create_deep_agent\n\nagent = create_deep_agent()  # Default: StateBackend\nresult = agent.invoke({\n    \"messages\": [{\"role\": \"user\", \"content\": \"Write notes to \u002Fdraft.txt\"}]\n}, config={\"configurable\": {\"thread_id\": \"thread-1\"}})\n# \u002Fdraft.txt is lost when thread ends\n```\n\u003C\u002Fpython>\n\u003Ctypescript>\nDefault StateBackend stores files ephemerally within a thread.\n\n```typescript\nimport { createDeepAgent } from \"deepagents\";\n\nconst agent = await createDeepAgent();  \u002F\u002F Default: StateBackend\nconst result = await agent.invoke({\n  messages: [{ role: \"user\", content: \"Write notes to \u002Fdraft.txt\" }]\n}, { configurable: { thread_id: \"thread-1\" } });\n\u002F\u002F \u002Fdraft.txt is lost when thread ends\n```\n\u003C\u002Ftypescript>\n\u003C\u002Fex-default-state-backend>\n\n\u003Cex-composite-backend-for-hybrid>\n\u003Cpython>\nConfigure CompositeBackend to route paths to different storage backends.\n\n```python\nfrom deepagents import create_deep_agent\nfrom deepagents.backends import CompositeBackend, StateBackend, StoreBackend\nfrom langgraph.store.memory import InMemoryStore\n\nstore = InMemoryStore()\n\ncomposite_backend = lambda rt: CompositeBackend(\n    default=StateBackend(rt),\n    routes={\"\u002Fmemories\u002F\": StoreBackend(rt)}\n)\n\nagent = create_deep_agent(backend=composite_backend, store=store)\n\n# \u002Fdraft.txt -> ephemeral (StateBackend)\n# \u002Fmemories\u002Fuser-prefs.txt -> persistent (StoreBackend)\n```\n\u003C\u002Fpython>\n\u003Ctypescript>\nConfigure CompositeBackend to route paths to different storage backends.\n\n```typescript\nimport { createDeepAgent, CompositeBackend, StateBackend, StoreBackend } from \"deepagents\";\nimport { InMemoryStore } from \"@langchain\u002Flanggraph\";\n\nconst store = new InMemoryStore();\n\nconst agent = await createDeepAgent({\n  backend: (config) => new CompositeBackend(\n    new StateBackend(config),\n    { \"\u002Fmemories\u002F\": new StoreBackend(config) }\n  ),\n  store\n});\n\n\u002F\u002F \u002Fdraft.txt -> ephemeral (StateBackend)\n\u002F\u002F \u002Fmemories\u002Fuser-prefs.txt -> persistent (StoreBackend)\n```\n\u003C\u002Ftypescript>\n\u003C\u002Fex-composite-backend-for-hybrid>\n\n\u003Cex-cross-session-memory>\n\u003Cpython>\nFiles in \u002Fmemories\u002F persist across threads via StoreBackend routing.\n\n```python\n# Using CompositeBackend from previous example\nconfig1 = {\"configurable\": {\"thread_id\": \"thread-1\"}}\nagent.invoke({\"messages\": [{\"role\": \"user\", \"content\": \"Save to \u002Fmemories\u002Fstyle.txt\"}]}, config=config1)\n\nconfig2 = {\"configurable\": {\"thread_id\": \"thread-2\"}}\nagent.invoke({\"messages\": [{\"role\": \"user\", \"content\": \"Read \u002Fmemories\u002Fstyle.txt\"}]}, config=config2)\n# Thread 2 can read file saved by Thread 1\n```\n\u003C\u002Fpython>\n\u003Ctypescript>\nFiles in \u002Fmemories\u002F persist across threads via StoreBackend routing.\n\n```typescript\n\u002F\u002F Using CompositeBackend from previous example\nconst config1 = { configurable: { thread_id: \"thread-1\" } };\nawait agent.invoke({ messages: [{ role: \"user\", content: \"Save to \u002Fmemories\u002Fstyle.txt\" }] }, config1);\n\nconst config2 = { configurable: { thread_id: \"thread-2\" } };\nawait agent.invoke({ messages: [{ role: \"user\", content: \"Read \u002Fmemories\u002Fstyle.txt\" }] }, config2);\n\u002F\u002F Thread 2 can read file saved by Thread 1\n```\n\u003C\u002Ftypescript>\n\u003C\u002Fex-cross-session-memory>\n\n\u003Cex-filesystem-backend-local-dev>\n\u003Cpython>\nUse FilesystemBackend for local development with real disk access and human-in-the-loop.\n\n```python\nfrom deepagents import create_deep_agent\nfrom deepagents.backends import FilesystemBackend\nfrom langgraph.checkpoint.memory import MemorySaver\n\nagent = create_deep_agent(\n    backend=FilesystemBackend(root_dir=\".\", virtual_mode=True),  # Restrict access\n    interrupt_on={\"write_file\": True, \"edit_file\": True},\n    checkpointer=MemorySaver()\n)\n\n# Agent can read\u002Fwrite actual files on disk\n```\n\u003C\u002Fpython>\n\u003Ctypescript>\nUse FilesystemBackend for local development with real disk access and human-in-the-loop.\n\n```typescript\nimport { createDeepAgent, FilesystemBackend } from \"deepagents\";\nimport { MemorySaver } from \"@langchain\u002Flanggraph\";\n\nconst agent = await createDeepAgent({\n  backend: new FilesystemBackend({ rootDir: \".\", virtualMode: true }),\n  interruptOn: { write_file: true, edit_file: true },\n  checkpointer: new MemorySaver()\n});\n```\n\u003C\u002Ftypescript>\n\n**Security: Never use FilesystemBackend in web servers - use StateBackend or sandbox instead.**\n\u003C\u002Fex-filesystem-backend-local-dev>\n\n\u003Cex-store-in-custom-tools>\n\u003Cpython>\nAccess the store directly in custom tools for long-term memory operations.\n\n```python\nfrom langchain.tools import tool, ToolRuntime\nfrom langchain.agents import create_agent\nfrom langgraph.store.memory import InMemoryStore\n\n@tool\ndef get_user_preference(key: str, runtime: ToolRuntime) -> str:\n    \"\"\"Get a user preference from long-term storage.\"\"\"\n    store = runtime.store\n    result = store.get((\"user_prefs\",), key)\n    return str(result.value) if result else \"Not found\"\n\n@tool\ndef save_user_preference(key: str, value: str, runtime: ToolRuntime) -> str:\n    \"\"\"Save a user preference to long-term storage.\"\"\"\n    store = runtime.store\n    store.put((\"user_prefs\",), key, {\"value\": value})\n    return f\"Saved {key}={value}\"\n\nstore = InMemoryStore()\n\nagent = create_agent(\n    model=\"gpt-4.1\",\n    tools=[get_user_preference, save_user_preference],\n    store=store\n)\n```\n\u003C\u002Fpython>\n\u003C\u002Fex-store-in-custom-tools>\n\n\u003Cboundaries>\n### What Agents CAN Configure\n\n- Backend type and configuration\n- Routing rules for CompositeBackend\n- Root directory for FilesystemBackend\n- Human-in-the-loop for file operations\n\n### What Agents CANNOT Configure\n\n- Tool names (ls, read_file, write_file, edit_file, glob, grep)\n- Access files outside virtual_mode restrictions\n- Cross-thread file access without proper backend setup\n\u003C\u002Fboundaries>\n\n\u003Cfix-storebackend-requires-store>\n\u003Cpython>\nStoreBackend requires a store instance.\n\n```python\n# WRONG\nagent = create_deep_agent(backend=lambda rt: StoreBackend(rt))\n\n# CORRECT\nagent = create_deep_agent(backend=lambda rt: StoreBackend(rt), store=InMemoryStore())\n```\n\u003C\u002Fpython>\n\u003Ctypescript>\nStoreBackend requires a store instance.\n\n```typescript\n\u002F\u002F WRONG\nconst agent = await createDeepAgent({ backend: (c) => new StoreBackend(c) });\n\n\u002F\u002F CORRECT\nconst agent = await createDeepAgent({ backend: (c) => new StoreBackend(c), store: new InMemoryStore() });\n```\n\u003C\u002Ftypescript>\n\u003C\u002Ffix-storebackend-requires-store>\n\n\u003Cfix-statebackend-files-dont-persist>\n\u003Cpython>\nStateBackend files are thread-scoped - use same thread_id or StoreBackend for cross-thread access.\n\n```python\n# WRONG: thread-2 can't read file from thread-1\nagent.invoke({\"messages\": [...]}, config={\"configurable\": {\"thread_id\": \"thread-1\"}})  # Write\nagent.invoke({\"messages\": [...]}, config={\"configurable\": {\"thread_id\": \"thread-2\"}})  # File not found!\n```\n\u003C\u002Fpython>\n\u003Ctypescript>\nStateBackend files are thread-scoped - use same thread_id or StoreBackend for cross-thread access.\n\n```typescript\n\u002F\u002F WRONG: thread-2 can't read file from thread-1\nawait agent.invoke({ messages: [...] }, { configurable: { thread_id: \"thread-1\" } });  \u002F\u002F Write\nawait agent.invoke({ messages: [...] }, { configurable: { thread_id: \"thread-2\" } });  \u002F\u002F File not found!\n```\n\u003C\u002Ftypescript>\n\u003C\u002Ffix-statebackend-files-dont-persist>\n\n\u003Cfix-path-prefix-for-persistence>\n\u003Cpython>\nPath must match CompositeBackend route prefix for persistence.\n\n```python\n# With routes={\"\u002Fmemories\u002F\": StoreBackend(rt)}:\nagent.invoke(...)  # \u002Fprefs.txt -> ephemeral (no match)\nagent.invoke(...)  # \u002Fmemories\u002Fprefs.txt -> persistent (matches route)\n```\n\u003C\u002Fpython>\n\u003Ctypescript>\nPath must match CompositeBackend route prefix for persistence.\n\n```typescript\n\u002F\u002F With routes: { \"\u002Fmemories\u002F\": StoreBackend }:\nawait agent.invoke(...);  \u002F\u002F \u002Fprefs.txt -> ephemeral (no match)\nawait agent.invoke(...);  \u002F\u002F \u002Fmemories\u002Fprefs.txt -> persistent (matches route)\n```\n\u003C\u002Ftypescript>\n\u003C\u002Ffix-path-prefix-for-persistence>\n\n\u003Cfix-production-store>\n\u003Cpython>\nUse PostgresStore for production (InMemoryStore lost on restart).\n\n```python\n# WRONG                              # CORRECT\nstore = InMemoryStore()              store = PostgresStore(connection_string=\"postgresql:\u002F\u002F...\")\n```\n\u003C\u002Fpython>\n\u003Ctypescript>\nUse PostgresStore for production (InMemoryStore lost on restart).\n\n```typescript\n\u002F\u002F WRONG                                    \u002F\u002F CORRECT\nconst store = new InMemoryStore();          const store = new PostgresStore({ connectionString: \"...\" });\n```\n\u003C\u002Ftypescript>\n\u003C\u002Ffix-production-store>\n\n\u003Cfix-filesystem-backend-needs-virtual-mode>\n\u003Cpython>\nEnable virtual_mode=True to restrict path access (prevents ..\u002F and ~\u002F escapes).\n\n```python\nbackend = FilesystemBackend(root_dir=\"\u002Fproject\", virtual_mode=True)  # Secure\n```\n\u003C\u002Fpython>\n\u003C\u002Ffix-filesystem-backend-needs-virtual-mode>\n\n\u003Cfix-longest-prefix-match>\n\u003Cpython>\nCompositeBackend matches longest prefix first.\n\n```python\nroutes = {\"\u002Fmem\u002F\": StoreBackend(rt), \"\u002Fmem\u002Ftemp\u002F\": StateBackend(rt)}\n# \u002Fmem\u002Ffile.txt -> StoreBackend, \u002Fmem\u002Ftemp\u002Ffile.txt -> StateBackend (longer match)\n```\n\u003C\u002Fpython>\n\u003C\u002Ffix-longest-prefix-match>\n","\u003Coverview>\nDeep Agents use pluggable backends for file operations and memory:\n\n**Short-term (StateBackend)**: Persists within a single thread, lost when thread ends\n**Long-term (StoreBackend)**: Persists across threads and sessions\n**Hybrid (CompositeBackend)**: Route different paths to different backends\n\nFilesystemMiddleware provides tools: `ls`, `read_file`, `write_file`, `edit_file`, `glob`, `grep`\n\u003C\u002Foverview>\n\n\u003Cbackend-selection>\n\n| Use Case | Backend | Why |\n|----------|---------|-----|\n| Temporary working files | StateBackend | Default, no setup |\n| Local development CLI | FilesystemBackend | Direct disk access |\n| Cross-session memory | StoreBackend | Persists across threads |\n| Hybrid storage | CompositeBackend | Mix ephemeral + persistent |\n\n\u003C\u002Fbackend-selection>\n\n\u003Cex-default-state-backend>\n\u003Cpython>\nDefault StateBackend stores files ephemerally within a thread.\n\n```python\nfrom deepagents import create_deep_agent\n\nagent = create_deep_agent()  # Default: StateBackend\nresult = agent.invoke({\n    \"messages\": [{\"role\": \"user\", \"content\": \"Write notes to \u002Fdraft.txt\"}]\n}, config={\"configurable\": {\"thread_id\": \"thread-1\"}})\n# \u002Fdraft.txt is lost when thread ends\n```\n\u003C\u002Fpython>\n\u003Ctypescript>\nDefault StateBackend stores files ephemerally within a thread.\n\n```typescript\nimport { createDeepAgent } from \"deepagents\";\n\nconst agent = await createDeepAgent();  \u002F\u002F Default: StateBackend\nconst result = await agent.invoke({\n  messages: [{ role: \"user\", content: \"Write notes to \u002Fdraft.txt\" }]\n}, { configurable: { thread_id: \"thread-1\" } });\n\u002F\u002F \u002Fdraft.txt is lost when thread ends\n```\n\u003C\u002Ftypescript>\n\u003C\u002Fex-default-state-backend>\n\n\u003Cex-composite-backend-for-hybrid>\n\u003Cpython>\nConfigure CompositeBackend to route paths to different storage backends.\n\n```python\nfrom deepagents import create_deep_agent\nfrom deepagents.backends import CompositeBackend, StateBackend, StoreBackend\nfrom langgraph.store.memory import InMemoryStore\n\nstore = InMemoryStore()\n\ncomposite_backend = lambda rt: CompositeBackend(\n    default=StateBackend(rt),\n    routes={\"\u002Fmemories\u002F\": StoreBackend(rt)}\n)\n\nagent = create_deep_agent(backend=composite_backend, store=store)\n\n# \u002Fdraft.txt -> ephemeral (StateBackend)\n# \u002Fmemories\u002Fuser-prefs.txt -> persistent (StoreBackend)\n```\n\u003C\u002Fpython>\n\u003Ctypescript>\nConfigure CompositeBackend to route paths to different storage backends.\n\n```typescript\nimport { createDeepAgent, CompositeBackend, StateBackend, StoreBackend } from \"deepagents\";\nimport { InMemoryStore } from \"@langchain\u002Flanggraph\";\n\nconst store = new InMemoryStore();\n\nconst agent = await createDeepAgent({\n  backend: (config) => new CompositeBackend(\n    new StateBackend(config),\n    { \"\u002Fmemories\u002F\": new StoreBackend(config) }\n  ),\n  store\n});\n\n\u002F\u002F \u002Fdraft.txt -> ephemeral (StateBackend)\n\u002F\u002F \u002Fmemories\u002Fuser-prefs.txt -> persistent (StoreBackend)\n```\n\u003C\u002Ftypescript>\n\u003C\u002Fex-composite-backend-for-hybrid>\n\n\u003Cex-cross-session-memory>\n\u003Cpython>\nFiles in \u002Fmemories\u002F persist across threads via StoreBackend routing.\n\n```python\n# Using CompositeBackend from previous example\nconfig1 = {\"configurable\": {\"thread_id\": \"thread-1\"}}\nagent.invoke({\"messages\": [{\"role\": \"user\", \"content\": \"Save to \u002Fmemories\u002Fstyle.txt\"}]}, config=config1)\n\nconfig2 = {\"configurable\": {\"thread_id\": \"thread-2\"}}\nagent.invoke({\"messages\": [{\"role\": \"user\", \"content\": \"Read \u002Fmemories\u002Fstyle.txt\"}]}, config=config2)\n# Thread 2 can read file saved by Thread 1\n```\n\u003C\u002Fpython>\n\u003Ctypescript>\nFiles in \u002Fmemories\u002F persist across threads via StoreBackend routing.\n\n```typescript\n\u002F\u002F Using CompositeBackend from previous example\nconst config1 = { configurable: { thread_id: \"thread-1\" } };\nawait agent.invoke({ messages: [{ role: \"user\", content: \"Save to \u002Fmemories\u002Fstyle.txt\" }] }, config1);\n\nconst config2 = { configurable: { thread_id: \"thread-2\" } };\nawait agent.invoke({ messages: [{ role: \"user\", content: \"Read \u002Fmemories\u002Fstyle.txt\" }] }, config2);\n\u002F\u002F Thread 2 can read file saved by Thread 1\n```\n\u003C\u002Ftypescript>\n\u003C\u002Fex-cross-session-memory>\n\n\u003Cex-filesystem-backend-local-dev>\n\u003Cpython>\nUse FilesystemBackend for local development with real disk access and human-in-the-loop.\n\n```python\nfrom deepagents import create_deep_agent\nfrom deepagents.backends import FilesystemBackend\nfrom langgraph.checkpoint.memory import MemorySaver\n\nagent = create_deep_agent(\n    backend=FilesystemBackend(root_dir=\".\", virtual_mode=True),  # Restrict access\n    interrupt_on={\"write_file\": True, \"edit_file\": True},\n    checkpointer=MemorySaver()\n)\n\n# Agent can read\u002Fwrite actual files on disk\n```\n\u003C\u002Fpython>\n\u003Ctypescript>\nUse FilesystemBackend for local development with real disk access and human-in-the-loop.\n\n```typescript\nimport { createDeepAgent, FilesystemBackend } from \"deepagents\";\nimport { MemorySaver } from \"@langchain\u002Flanggraph\";\n\nconst agent = await createDeepAgent({\n  backend: new FilesystemBackend({ rootDir: \".\", virtualMode: true }),\n  interruptOn: { write_file: true, edit_file: true },\n  checkpointer: new MemorySaver()\n});\n```\n\u003C\u002Ftypescript>\n\n**Security: Never use FilesystemBackend in web servers - use StateBackend or sandbox instead.**\n\u003C\u002Fex-filesystem-backend-local-dev>\n\n\u003Cex-store-in-custom-tools>\n\u003Cpython>\nAccess the store directly in custom tools for long-term memory operations.\n\n```python\nfrom langchain.tools import tool, ToolRuntime\nfrom langchain.agents import create_agent\nfrom langgraph.store.memory import InMemoryStore\n\n@tool\ndef get_user_preference(key: str, runtime: ToolRuntime) -> str:\n    \"\"\"Get a user preference from long-term storage.\"\"\"\n    store = runtime.store\n    result = store.get((\"user_prefs\",), key)\n    return str(result.value) if result else \"Not found\"\n\n@tool\ndef save_user_preference(key: str, value: str, runtime: ToolRuntime) -> str:\n    \"\"\"Save a user preference to long-term storage.\"\"\"\n    store = runtime.store\n    store.put((\"user_prefs\",), key, {\"value\": value})\n    return f\"Saved {key}={value}\"\n\nstore = InMemoryStore()\n\nagent = create_agent(\n    model=\"gpt-4.1\",\n    tools=[get_user_preference, save_user_preference],\n    store=store\n)\n```\n\u003C\u002Fpython>\n\u003C\u002Fex-store-in-custom-tools>\n\n\u003Cboundaries>\n### What Agents CAN Configure\n\n- Backend type and configuration\n- Routing rules for CompositeBackend\n- Root directory for FilesystemBackend\n- Human-in-the-loop for file operations\n\n### What Agents CANNOT Configure\n\n- Tool names (ls, read_file, write_file, edit_file, glob, grep)\n- Access files outside virtual_mode restrictions\n- Cross-thread file access without proper backend setup\n\u003C\u002Fboundaries>\n\n\u003Cfix-storebackend-requires-store>\n\u003Cpython>\nStoreBackend requires a store instance.\n\n```python\n# WRONG\nagent = create_deep_agent(backend=lambda rt: StoreBackend(rt))\n\n# CORRECT\nagent = create_deep_agent(backend=lambda rt: StoreBackend(rt), store=InMemoryStore())\n```\n\u003C\u002Fpython>\n\u003Ctypescript>\nStoreBackend requires a store instance.\n\n```typescript\n\u002F\u002F WRONG\nconst agent = await createDeepAgent({ backend: (c) => new StoreBackend(c) });\n\n\u002F\u002F CORRECT\nconst agent = await createDeepAgent({ backend: (c) => new StoreBackend(c), store: new InMemoryStore() });\n```\n\u003C\u002Ftypescript>\n\u003C\u002Ffix-storebackend-requires-store>\n\n\u003Cfix-statebackend-files-dont-persist>\n\u003Cpython>\nStateBackend files are thread-scoped - use same thread_id or StoreBackend for cross-thread access.\n\n```python\n# WRONG: thread-2 can't read file from thread-1\nagent.invoke({\"messages\": [...]}, config={\"configurable\": {\"thread_id\": \"thread-1\"}})  # Write\nagent.invoke({\"messages\": [...]}, config={\"configurable\": {\"thread_id\": \"thread-2\"}})  # File not found!\n```\n\u003C\u002Fpython>\n\u003Ctypescript>\nStateBackend files are thread-scoped - use same thread_id or StoreBackend for cross-thread access.\n\n```typescript\n\u002F\u002F WRONG: thread-2 can't read file from thread-1\nawait agent.invoke({ messages: [...] }, { configurable: { thread_id: \"thread-1\" } });  \u002F\u002F Write\nawait agent.invoke({ messages: [...] }, { configurable: { thread_id: \"thread-2\" } });  \u002F\u002F File not found!\n```\n\u003C\u002Ftypescript>\n\u003C\u002Ffix-statebackend-files-dont-persist>\n\n\u003Cfix-path-prefix-for-persistence>\n\u003Cpython>\nPath must match CompositeBackend route prefix for persistence.\n\n```python\n# With routes={\"\u002Fmemories\u002F\": StoreBackend(rt)}:\nagent.invoke(...)  # \u002Fprefs.txt -> ephemeral (no match)\nagent.invoke(...)  # \u002Fmemories\u002Fprefs.txt -> persistent (matches route)\n```\n\u003C\u002Fpython>\n\u003Ctypescript>\nPath must match CompositeBackend route prefix for persistence.\n\n```typescript\n\u002F\u002F With routes: { \"\u002Fmemories\u002F\": StoreBackend }:\nawait agent.invoke(...);  \u002F\u002F \u002Fprefs.txt -> ephemeral (no match)\nawait agent.invoke(...);  \u002F\u002F \u002Fmemories\u002Fprefs.txt -> persistent (matches route)\n```\n\u003C\u002Ftypescript>\n\u003C\u002Ffix-path-prefix-for-persistence>\n\n\u003Cfix-production-store>\n\u003Cpython>\nUse PostgresStore for production (InMemoryStore lost on restart).\n\n```python\n# WRONG                              # CORRECT\nstore = InMemoryStore()              store = PostgresStore(connection_string=\"postgresql:\u002F\u002F...\")\n```\n\u003C\u002Fpython>\n\u003Ctypescript>\nUse PostgresStore for production (InMemoryStore lost on restart).\n\n```typescript\n\u002F\u002F WRONG                                    \u002F\u002F CORRECT\nconst store = new InMemoryStore();          const store = new PostgresStore({ connectionString: \"...\" });\n```\n\u003C\u002Ftypescript>\n\u003C\u002Ffix-production-store>\n\n\u003Cfix-filesystem-backend-needs-virtual-mode>\n\u003Cpython>\nEnable virtual_mode=True to restrict path access (prevents ..\u002F and ~\u002F escapes).\n\n```python\nbackend = FilesystemBackend(root_dir=\"\u002Fproject\", virtual_mode=True)  # Secure\n```\n\u003C\u002Fpython>\n\u003C\u002Ffix-filesystem-backend-needs-virtual-mode>\n\n\u003Cfix-longest-prefix-match>\n\u003Cpython>\nCompositeBackend matches longest prefix first.\n\n```python\nroutes = {\"\u002Fmem\u002F\": StoreBackend(rt), \"\u002Fmem\u002Ftemp\u002F\": StateBackend(rt)}\n# \u002Fmem\u002Ffile.txt -> StoreBackend, \u002Fmem\u002Ftemp\u002Ffile.txt -> StateBackend (longer match)\n```\n\u003C\u002Fpython>\n\u003C\u002Ffix-longest-prefix-match>\n",{"name":5,"description":7},"main","c9d35c0e379f9b59b3807abb9a04d98437ffbffa",".agents\u002Fskills\u002Flangchain_skills\u002Fdeep-agents-memory",2,"https:\u002F\u002Fgithub.com\u002Fydf0509\u002Flc-agent","https:\u002F\u002Fgithub.com\u002Fydf0509","研究oop编程思想","2026-11-05 17:49:50",{"source":8,"skillName":5,"commands":32,"prompt":42,"zipAvailable":43},[33,36,39],{"tool":34,"command":35},"npx","npx skills add ydf0509\u002Flc-agent --skill deep-agents-memory",{"tool":37,"command":38},"bunx","bunx skills add ydf0509\u002Flc-agent --skill deep-agents-memory",{"tool":40,"command":41},"pnpm","pnpm dlx skills add ydf0509\u002Flc-agent --skill deep-agents-memory","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fydf0509\u002Flc-agent\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Flangchain_skills\u002Fdeep-agents-memory\u002FSKILL.md",true,[],[46,52,59,66,73,80],{"skillNo":47,"name":48,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":49,"categories":50,"keywords":51,"publishedAt":18},"01M75M719FJ3D75G010QKKGS9P","vision-bridge","https:\u002F\u002Fgithub.com\u002Fydf0509\u002Flc-agent\u002Fblob\u002Fmain\u002Flc_agent\u002Fskills\u002Fthird_party_skills\u002Fvision-bridge\u002FSKILL.md",[],[],{"skillNo":53,"name":54,"nameZh":6,"description":55,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":56,"categories":57,"keywords":58,"publishedAt":18},"01M75M6WQ4JP3HHP635A4VA6XE","writing-skills","Use when creating new skills, editing existing skills, or verifying skills work before deployment","https:\u002F\u002Fgithub.com\u002Fydf0509\u002Flc-agent\u002Fblob\u002Fmain\u002Flc_agent\u002Fskills\u002Fthird_party_skills\u002Fsuperpowers\u002Fwriting-skills\u002FSKILL.md",[],[],{"skillNo":60,"name":61,"nameZh":6,"description":62,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":63,"categories":64,"keywords":65,"publishedAt":18},"01M75M6SNFFXN1WM46XAJTZM2B","writing-plans","Use when you have a spec or requirements for a multi-step task, before touching code","https:\u002F\u002Fgithub.com\u002Fydf0509\u002Flc-agent\u002Fblob\u002Fmain\u002Flc_agent\u002Fskills\u002Fthird_party_skills\u002Fsuperpowers\u002Fwriting-plans\u002FSKILL.md",[],[],{"skillNo":67,"name":68,"nameZh":6,"description":69,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":70,"categories":71,"keywords":72,"publishedAt":18},"01M75M6PR8M5KYVWT4XJGMY9Y9","verification-before-completion","Use when about to claim work is complete, fixed, or passing, before committing or creating PRs - requires running verification commands and confirming output before making any success claims; evidence before assertions always","https:\u002F\u002Fgithub.com\u002Fydf0509\u002Flc-agent\u002Fblob\u002Fmain\u002Flc_agent\u002Fskills\u002Fthird_party_skills\u002Fsuperpowers\u002Fverification-before-completion\u002FSKILL.md",[],[],{"skillNo":74,"name":75,"nameZh":6,"description":76,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":77,"categories":78,"keywords":79,"publishedAt":18},"01M75M6KQX25K40ZP204NFF89K","using-superpowers","Use when starting any conversation - establishes how to find and use skills, requiring skill invocation before ANY response including clarifying questions","https:\u002F\u002Fgithub.com\u002Fydf0509\u002Flc-agent\u002Fblob\u002Fmain\u002Flc_agent\u002Fskills\u002Fthird_party_skills\u002Fsuperpowers\u002Fusing-superpowers\u002FSKILL.md",[],[],{"skillNo":81,"name":82,"nameZh":6,"description":83,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":84,"categories":85,"keywords":86,"publishedAt":18},"01M75M6FYAG0D8EP8WXYNMVKQM","using-git-worktrees","Use when starting feature work that needs isolation from current workspace or before executing implementation plans - ensures an isolated workspace exists via native tools or git worktree fallback","https:\u002F\u002Fgithub.com\u002Fydf0509\u002Flc-agent\u002Fblob\u002Fmain\u002Flc_agent\u002Fskills\u002Fthird_party_skills\u002Fsuperpowers\u002Fusing-git-worktrees\u002FSKILL.md",[],[]]