Files
MemRelay/projects/d5a7f581-c442-4554-87b9-ee723b8b0258/OpenCode 导出提示词要锁死 SQL 和绝对路径.md
T
memrelay 7469dacc73 update: OpenCode 导出提示词要锁死 SQL 和绝对路径
MemRelay-Operation: memory-save:opencode-prompt-contract-20261111-2
MemRelay-Resource: a1c2c463-892d-4d3a-bafc-fa3edccb20d7
2026-11-11 00:55:51 +08:00

28 lines
1.6 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
title: OpenCode 导出提示词要锁死 SQL 和绝对路径
type: experience
permalink: main/projects/d5a7f581-c442-4554-87b9-ee723b8b0258/open-code-导出提示词要锁死-sql-和绝对路径
stable_id: a1c2c463-892d-4d3a-bafc-fa3edccb20d7
scope: project
memory_type: experience
project_id: d5a7f581-c442-4554-87b9-ee723b8b0258
usage_profile_id: 0c9feb46-d06e-43cd-9ef0-c5813c84a998
status: active
revision: 2
request_id: opencode-prompt-contract-20261111-2
created_at: '2026-11-10T16:49:27.968106+00:00'
updated_at: '2026-11-10T16:55:49.709218+00:00'
tags:
- OpenCode
- 提示词
- workspace
---
## 做法
给 OpenCode 的提示词一次只导出一个文件,并写死技能、SQL、绝对保存目录、文件名和结束行。保存、读取和删除都只使用 /workspace 及其子目录。程序不解析聊天正文,只认导出脚本打印的「文件已保存至」路径;路径必须位于 /workspace 下。等到 session.idle 后按该路径调用 file/content,directory 参数固定为 /workspace,再核对表头。
## 依据
adhoc_query 技能默认不导出,只有提示词明确要求导出才调用 script/download-file-all-async.py。参数是 --sql 和 --save-dir,保存目录必须是绝对路径且不能是「.」。文件名要用 --filename 指定。用户确认其他目录会出错,而且无法删除文件。超过 10 万行时技能会再向用户确认,单小区或单站点任务不会触发。
## 已验证
nqi-agent.chlz 中文件落在 /workspace/data/2026-11-09/,file/content 的 directory 是 /workspace。清理命令是 rm -rf "/workspace/data/2026-11-09"。