Fetches workspace identity from the database and generates a markdown summary for agent context.
// Source: https://github.com/mperkins0155/crm | License: MIT | Copyright 2026 Comp AI
// Provided via justclaw.it.com; keep this notice with the code.
import { db } from "@crm/db";
import {
readWorkspaceIdentity,
type WorkspaceIdentity,
} from "@crm/db/workspace";
export type { WorkspaceIdentity };
export async function identity(): Promise<WorkspaceIdentity | null> {
try {
return await readWorkspaceIdentity(db);
} catch (error) {
console.error("[agent] could not read who we are", error);
return null;
}
}
export function usMarkdown(us: WorkspaceIdentity | null): string {
if (!us) return "";
const lines = ["## Who we are", ""];
lines.push(
`You work for **${us.name}**${us.website ? ` (${us.website})` : ""}.`,
);
if (!us.profile) {
lines.push(
"Nothing else about
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search 40K more like it.
Get a free API key