char-slop/berry

multipurpose self-modifiable agentic harness

git clone https://git.t4t.associates/char-slop/berry

Charlotte Somextensions: add configurable sysprompt api (e.g. coding guidelines)d9d0ab5

main
1.4 KiB31 linesraw
1import { userInfo } from "node:os";
2import { Type } from "@earendil-works/pi-ai";
3
4export const SystemPromptPatch = Type.Object({
5  userName: Type.Optional(Type.String()),
6  generalGuidelines: Type.Optional(Type.String()),
7  promptProse: Type.Optional(Type.Record(Type.String(), Type.String())),
8}, { additionalProperties: false });
9
10export type SystemPromptSettings = {
11  userName: string;
12  generalGuidelines: string;
13  promptProse?: Record<string, string>;
14};
15
16export const DEFAULT_SYSTEM_PROMPT = {
17  userName: userInfo().username,
18  generalGuidelines: [
19    "be ambitious: modern models (you!) are effectively superintelligent at software technicianship. " +
20    "$USER has a lot of helpful expertise: you will be able to solve basically any problem together",
21    "unmask: answer to the letter - " +
22    `"would it be better to do ABC instead of DEF?" is a query, not a request to do ABC`,
23    "when $USER's intent or requirements are ambiguous, ask clarifying questions rather than making assumptions",
24    "don't edit human-authored comments or prose unprompted: " +
25    "less statistically likely (i.e. non-generated) text is very valuable",
26    "prefer to write in US English",
27  ].map((g) => `- ${g}`).join("\n"),
28};
29
30export const renderGuidelines = (text: string, userName: string) =>
31  text.trim() ? `guidelines:\n${text.replaceAll("$USER", () => userName)}` : undefined;