People should be able to post a thread without a workspace
No all threads need a workspace
Screenshot shows a signed-in viewer with no workspace membership: they can read everything but get "ask a workspace member for an invite link" and no New thread button. Plan: make the workspace optional on a thread.
Model
threads.workspace_idbecomes nullable (migration0003_optional_workspace). A thread with no workspace is a plain discussion thread: readable by everyone (already true), and any signed-in user can create one, reply in it, and delete their own.- No workspace ⇒ no repos, no owner GitHub token, no memory scope ⇒ no Claude runs on these threads (Ask Claude / ▶ ask Claude / fork are hidden in the UI and rejected server-side with 400). Keeping agent runs workspace-scoped avoids a much larger change to the launcher/runner/finish pipeline; can be a follow-up if wanted.
UI
/threads/new: workspace picker gets a "No workspace — general discussion" option (default when you're a member of none); Ask Claude + model controls disappear when it's selected. The "you're not a member of any workspace" dead-end goes away.- Home: New thread button always shown; guest note reworded.
- Thread page/list: workspace-less threads show "general discussion" instead of workspace · repos · branch; composer without the Ask Claude checkbox.
Plumbing: requireThreadMember allows anyone on workspace-less threads; embedding/memory-candidate flagging skipped when there's no workspace; agent paths (launch/worker/finish/context/internal job routes) get explicit guards since the nullable type now flows through them.
threadide@8134acaThreads no longer need a workspace. Pushed to thread/a8a27d75 (8134aca), typecheck clean.
What changed
Model — threads.workspace_id is nullable (drizzle/0003_optional_workspace.sql, one DROP NOT NULL; run npm run db:migrate). A thread with workspace_id = null is a general discussion thread:
- Any signed-in user can start one, reply in it, and delete their own (
requireThreadMemberskips the membership check when there's no workspace; DELETE falls back to creator-only). - Claude can't be asked there. There are no repos to clone, no owner GitHub token, no memory scope. New
requireWorkspaceForAgent()inlib/session.tsreturns 400 fromPOST …/posts(withaskClaude),…/posts/:id/runand…/fork;POST /api/threadsrejectsaskClaudewithout aworkspaceId.lib/data.tsdouble-checks increateThread/addHumanPost/queueRunForPost/forkThreadas a safety net.
UI
/threads/new: workspace picker gains "None — general discussion" (preselected when you're a member of no workspace). Choosing it hides Ask Claude + model picker; the button reads "Post thread". The "you're not a member of any workspace" dead-end page is gone.- Home: New thread is always shown; the guest note now says you can start/join general threads and links to
/workspaces. The "No workspaces yet" early-return card is gone too (the list + button render regardless). - Thread page: meta line shows
general discussion · OPEN · liveinstead of workspace · repos · branch;ComposerandPostViewtakecanAskClaudeand hide the Ask Claude checkbox, model picker, ▶ ask Claude and fork. - Thread list: workspace-less rows get a small
generallabel where the workspace · repos line would be.
Plumbing — thread.workspace is now typed Workspace | null, so every consumer had to decide: embedPost/addAgentPost accept null (embedding is a no-op, memory-candidate flagging skipped); launch.ts/worker throw → job fails cleanly; context.ts throws; finish.ts tolerates (skips PRs); internal job routes return 409/empty/"not saved" for context/search/memory. None of these can actually be reached today because no job can be queued without a workspace — they're there so the type system doesn't lie.
Docs: README + architecture.md access-model lines updated.
Not done / follow-ups
- Claude in general threads (Q&A without repos) would be a real feature: needs a "no-repo" runner mode, a token source other than the workspace owner, and a decision on where memory/embeddings live. Happy to take it as a separate thread if wanted.
- Screenshots below are static mockups on the real
globals.css(the app needs Postgres + OAuth to run here); the sandbox lacks the serif font so type looks different from prod, layout is faithful.
Diff · 27 files
diff --git a/threadide/db/schema.ts b/threadide/db/schema.ts
@@ -158,9 +158,9 @@ export const threads = pgTable(
"threads",
{
id: uuid("id").primaryKey().defaultRandom(),
- workspaceId: uuid("workspace_id")
- .notNull()
- .references(() => workspaces.id, { onDelete: "cascade" }),
+ // Null = a general discussion thread with no repos behind it. Anyone signed in can post there,
+ // but Claude can't be asked (no repos, no owner token, no memory scope).
+ workspaceId: uuid("workspace_id").references(() => workspaces.id, { onDelete: "cascade" }),
diff --git a/threadide/drizzle/0003_optional_workspace.sql b/threadide/drizzle/0003_optional_workspace.sql
new file mode 100644
@@ -0,0 +1,2 @@
+-- Threads no longer need a workspace: null = general discussion thread (no repos, no Claude runs).
+ALTER TABLE "threads" ALTER COLUMN "workspace_id" DROP NOT NULL;
diff --git a/threadide/lib/session.ts b/threadide/lib/session.ts
@@ -69,14 +69,25 @@ export async function requireThreadExists(threadId: string) {
-/** For write paths: threads inherit write access from their workspace membership. */
+/**
+ * For write paths: threads inherit write access from their workspace membership.
+ * Threads with no workspace (general discussion) are open to every signed-in user.
+ */
export async function requireThreadMember(threadId: string, user: CurrentUser) {
const [t] = await db.select({ workspaceId: threads.workspaceId }).from(threads).where(eq(threads.id, threadId));
if (!t) throw new Forbidden(404, "not found");
- await requireMember(t.workspaceId, user);
+ if (t.workspaceId) await requireMember(t.workspaceId, user);
return t;
}
+/**
+ * Agent runs need repos, an owner GitHub token and a memory scope, all of which live on the
+ * workspace. Call this before queueing a run (Ask Claude, ▶ ask Claude, fork).
+ */
+export function requireWorkspaceForAgent(t: { workspaceId: string | null }) {
+ if (!t.workspaceId) throw new Forbidden(400, "this thread has no workspace, so Claude can't be asked here");
+}
diff --git a/threadide/app/api/threads/route.ts b/threadide/app/api/threads/route.ts
@@ -13,7 +13,8 @@ export const GET = guarded(async (req: Request) => {
const Body = z.object({
- workspaceId: z.string().uuid(),
+ // Omitted/null = general discussion thread: anyone signed in can create one, but Claude can't be asked.
+ workspaceId: z.string().uuid().nullable().optional(),
@@ -25,7 +26,9 @@ export const POST = guarded(async (req: Request) => {
if (!parsed.success) return NextResponse.json({ error: parsed.error.flatten() }, { status: 400 });
- await requireMember(parsed.data.workspaceId, user);
- const thread = await createThread({ ...parsed.data, author: user });
+ const workspaceId = parsed.data.workspaceId ?? null;
+ if (workspaceId) await requireMember(workspaceId, user);
+ else if (parsed.data.askClaude) return NextResponse.json({ error: "pick a workspace to ask Claude; threads without one are discussion only" }, { status: 400 });
+ const thread = await createThread({ ...parsed.data, workspaceId, author: user });
diff --git a/threadide/app/page.tsx b/threadide/app/page.tsx
@@ -10,31 +10,22 @@ export default async function Home() {
- const canPost = workspaces.some((w) => w.myRole !== null);
-
- if (workspaces.length === 0) {
- return (
- <div className="card">
- <p>No workspaces yet.</p>
- ...
- </div>
- );
- }
+ // Anyone can start a general discussion thread; posting in a workspace needs membership.
+ const isMember = workspaces.some((w) => w.myRole !== null);
<div className="page-head">
<h2 className="page-title">Threads</h2>
- {canPost && <Link href="/threads/new">New thread</Link>}
+ <Link href="/threads/new">New thread</Link>
</div>
- {!canPost && (
+ {!isMember && (
<p className="muted guest-note">
- You can read everything here. To reply or start a thread, ask a workspace member for an invite link.
+ You can read everything here and start or join general discussion threads. To post in a workspace (and ask Claude to work on its repos),{" "}
+ <Link href="/workspaces">create one</Link> or ask a member for an invite link.
</p>
)}
diff --git a/threadide/components/new-thread-form.tsx b/threadide/components/new-thread-form.tsx
@@ -3,9 +3,13 @@
+/** Empty option value = no workspace: a general discussion thread anyone can post in, with no Claude runs. */
+const NO_WORKSPACE = "";
+
export function NewThreadForm({ workspaces }: { workspaces: { id: string; name: string; aliases: string[] }[] }) {
- const [workspaceId, setWorkspaceId] = useState(workspaces[0]?.id ?? "");
+ const [workspaceId, setWorkspaceId] = useState(workspaces[0]?.id ?? NO_WORKSPACE);
+ const hasWorkspace = workspaceId !== NO_WORKSPACE;
@@ -60,6 +71,7 @@
))}
+ <option value={NO_WORKSPACE}>None — general discussion</option>
</select>
+ {!hasWorkspace && <span style={{ marginLeft: 8 }}>Anyone signed in can reply. Claude can't be asked without a workspace.</span>}
@@ (row) Ask Claude / model picker wrapped in {hasWorkspace && …}; button label uses willRun = hasWorkspace && askClaude
diff --git a/threadide/app/threads/[id]/page.tsx b/threadide/app/threads/[id]/page.tsx
@@ -24,10 +24,13 @@
- const member = await membership(thread.workspaceId, user.id);
- const canPost = member !== null;
- const canDelete = canPost && (thread.createdBy === user.id || member.role === "owner");
+ const ws = thread.workspace;
+ const member = ws ? await membership(ws.id, user.id) : null;
+ const canPost = ws ? member !== null : true;
+ const canAskClaude = ws !== null;
+ const canDelete = thread.createdBy === user.id || member?.role === "owner";
@@ meta line: {ws ? <workspace · repos · branch ·> : <>general discussion · </>}; PostView/Composer get canAskClaude={canAskClaude}Is there a PR for this?
No PR existed yet — the branch thread/a8a27d75 was pushed (8134aca) but never opened as a PR. Checked it against current main (which has moved on with #27/#28): merges cleanly, no conflicts. Opening the PR now.
threadide@dc29203There wasn't one — the branch had only been pushed. Now there is: PR #29 — Let threads exist without a workspace.
Before opening it I merged current main into the branch (it had moved on with #27 display-name revert and #28). The merge only touched auth.ts, no conflicts, and since #27 removed drizzle/0003_display_name.sql there's no migration-number clash with 0003_optional_workspace.sql. Typecheck is clean at dc29203.
After merging: run npm run db:migrate (one ALTER TABLE threads ALTER COLUMN workspace_id DROP NOT NULL).


