feat(core): reserved-port and API-key guardrails in the default system prompt (#24)

Co-authored-by: Alice <alice@prismshadow.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Yaowei Zheng
2026-07-22 22:04:30 +08:00
committed by GitHub
parent 849f2fa6d2
commit c9cd1f9dc5
10 changed files with 47 additions and 5 deletions
+3
View File
@@ -19,6 +19,9 @@
export * from "./omnimessage/index.js";
export * from "./interfaces.js";
// Only the default server port leaves internal: the CLI / server default-port source of truth.
export { DEFAULT_SERVER_PORT } from "./internal/ports.js";
// Submodules
export * from "./state/index.js";
export * from "./llm/index.js";
+10
View File
@@ -0,0 +1,10 @@
/**
* Default PenguinHarness server port (internal shared constant; the barrel re-exports
* only DEFAULT_SERVER_PORT, as the CLI `penguin server` / `penguin web` and server
* default-port source of truth — previously each hardcoded the number). It is a
* fallback only: the `--port` flag and the PORT environment variable override it at
* runtime.
*/
/** Default main server / Web UI port; deliberately avoids common defaults like 3000/8080. */
export const DEFAULT_SERVER_PORT = 7364;
+3 -1
View File
@@ -92,13 +92,15 @@ Communicate with the user precisely and concisely, yet with warmth. Do not repea
# Constraints
- Make the smallest change that satisfies the request; do not modify unrelated files.
- Destructive operations are forbidden.
- Never kill a process you did not start yourself (e.g. to free a busy port) unless the user explicitly asks you to.
- Never kill a process you did not start yourself unless the user explicitly asks you to, including PenguinHarness's own services. Never take a PenguinHarness service port for your own servers; when a port you want is busy, pick another free port instead of killing the listener.
- If a tool call fails, read the error, adjust, and retry; never repeat the same failing input.
- On an API authentication/authorization or API-key error (401/403, invalid or missing key), retry at most once.
# Stop rules
- Stop and give the final answer once the success criteria are met.
- If the request is ambiguous, stop and ask the user for clarification instead of guessing their intent.
- If you hit an error you cannot resolve, stop and report the blocker to the user.
- If an API auth/key error persists after that one retry, stop calling tools and ask the user to update the key in the agent's vault or the model settings outside the chat — the secret value must never be pasted into the conversation. Updated secrets only take effect in the next conversation, so further retries cannot succeed.
# Tool use
- Prefer solving problems with your tools: inspect the real files and environment and run real commands instead of answering from memory or guessing.