Skip to content

Commit 3437a2d

Browse files
Mikecranesyncclaude
andcommitted
feat(serena): add Serena project config + Agno agent for Cosmos demo
- .serena/project.yml: register FactoryLM as Serena project with language servers - .gitignore: exclude .serena/memories/ (local-only) - agents/serena_agent.py: Agno-powered web UI agent using Claude - scripts/start_serena_agent.sh: launch script for agent + Doppler secrets On other machines: `claude plugin install serena` to enable MCP tools. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 1c30951 commit 3437a2d

4 files changed

Lines changed: 85 additions & 93 deletions

File tree

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,3 +102,6 @@ _BUILDS/cosmos-demo-2026-02-05/
102102
# Manual backup folders
103103
scripts/openclaw/restore-feb8/
104104
_BUILDS/
105+
106+
# Serena memories (local)
107+
.serena/memories/

.serena/project.yml

Lines changed: 30 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -1,124 +1,61 @@
11
# the name by which the project can be referenced within Serena
2-
project_name: "factorylm-monorepo"
2+
project_name: "factorylm"
33

44

5-
# list of languages for which language servers are started; choose from:
6-
# al bash clojure cpp csharp
7-
# csharp_omnisharp dart elixir elm erlang
8-
# fortran fsharp go groovy haskell
9-
# java julia kotlin lua markdown
10-
# matlab nix pascal perl php
11-
# php_phpactor powershell python python_jedi r
12-
# rego ruby ruby_solargraph rust scala
13-
# swift terraform toml typescript typescript_vts
14-
# vue yaml zig
15-
# (This list may be outdated. For the current list, see values of Language enum here:
16-
# https://github.com/oraios/serena/blob/main/src/solidlsp/ls_config.py
17-
# For some languages, there are alternative language servers, e.g. csharp_omnisharp, ruby_solargraph.)
18-
# Note:
19-
# - For C, use cpp
20-
# - For JavaScript, use typescript
21-
# - For Free Pascal/Lazarus, use pascal
22-
# Special requirements:
23-
# Some languages require additional setup/installations.
24-
# See here for details: https://oraios.github.io/serena/01-about/020_programming-languages.html#language-servers
25-
# When using multiple languages, the first language server that supports a given file will be used for that file.
26-
# The first language is the default language and the respective language server will be used as a fallback.
27-
# Note that when using the JetBrains backend, language servers are not used and this list is correspondingly ignored.
5+
# list of languages for which language servers are started
286
languages:
29-
- java
7+
- python
8+
- typescript
309

3110
# the encoding used by text files in the project
32-
# For a list of possible encodings, see https://docs.python.org/3.11/library/codecs.html#standard-encodings
33-
encoding: "utf-8"
11+
encoding: utf-8
3412

3513
# whether to use project's .gitignore files to ignore files
3614
ignore_all_files_in_gitignore: true
3715

3816
# list of additional paths to ignore in this project.
39-
# Same syntax as gitignore, so you can use * and **.
40-
# Note: global ignored_paths from serena_config.yml are also applied additively.
41-
ignored_paths: []
17+
ignored_paths:
18+
- "node_modules/**"
19+
- "_BUILDS/**"
20+
- "output/**"
21+
- "Io_sim_images/**"
22+
- "traces/**"
23+
- "my-ralph/**"
24+
- "recordings/**"
25+
- "test_images/**"
26+
- "video/**"
27+
- ".claude/**"
28+
- "docs/archive/**"
4229

4330
# whether the project is in read-only mode
44-
# If set to true, all editing tools will be disabled and attempts to use them will result in an error
45-
# Added on 2025-04-18
4631
read_only: false
4732

48-
# list of tool names to exclude. We recommend not excluding any tools, see the readme for more details.
49-
# Below is the complete list of tools for convenience.
50-
# To make sure you have the latest list of tools, and to view their descriptions,
51-
# execute `uv run scripts/print_tool_overview.py`.
52-
#
53-
# * `activate_project`: Activates a project by name.
54-
# * `check_onboarding_performed`: Checks whether project onboarding was already performed.
55-
# * `create_text_file`: Creates/overwrites a file in the project directory.
56-
# * `delete_lines`: Deletes a range of lines within a file.
57-
# * `delete_memory`: Deletes a memory from Serena's project-specific memory store.
58-
# * `execute_shell_command`: Executes a shell command.
59-
# * `find_referencing_code_snippets`: Finds code snippets in which the symbol at the given location is referenced.
60-
# * `find_referencing_symbols`: Finds symbols that reference the symbol at the given location (optionally filtered by type).
61-
# * `find_symbol`: Performs a global (or local) search for symbols with/containing a given name/substring (optionally filtered by type).
62-
# * `get_current_config`: Prints the current configuration of the agent, including the active and available projects, tools, contexts, and modes.
63-
# * `get_symbols_overview`: Gets an overview of the top-level symbols defined in a given file.
64-
# * `initial_instructions`: Gets the initial instructions for the current project.
65-
# Should only be used in settings where the system prompt cannot be set,
66-
# e.g. in clients you have no control over, like Claude Desktop.
67-
# * `insert_after_symbol`: Inserts content after the end of the definition of a given symbol.
68-
# * `insert_at_line`: Inserts content at a given line in a file.
69-
# * `insert_before_symbol`: Inserts content before the beginning of the definition of a given symbol.
70-
# * `list_dir`: Lists files and directories in the given directory (optionally with recursion).
71-
# * `list_memories`: Lists memories in Serena's project-specific memory store.
72-
# * `onboarding`: Performs onboarding (identifying the project structure and essential tasks, e.g. for testing or building).
73-
# * `prepare_for_new_conversation`: Provides instructions for preparing for a new conversation (in order to continue with the necessary context).
74-
# * `read_file`: Reads a file within the project directory.
75-
# * `read_memory`: Reads the memory with the given name from Serena's project-specific memory store.
76-
# * `remove_project`: Removes a project from the Serena configuration.
77-
# * `replace_lines`: Replaces a range of lines within a file with new content.
78-
# * `replace_symbol_body`: Replaces the full definition of a symbol.
79-
# * `restart_language_server`: Restarts the language server, may be necessary when edits not through Serena happen.
80-
# * `search_for_pattern`: Performs a search for a pattern in the project.
81-
# * `summarize_changes`: Provides instructions for summarizing the changes made to the codebase.
82-
# * `switch_modes`: Activates modes by providing a list of their names
83-
# * `think_about_collected_information`: Thinking tool for pondering the completeness of collected information.
84-
# * `think_about_task_adherence`: Thinking tool for determining whether the agent is still on track with the current task.
85-
# * `think_about_whether_you_are_done`: Thinking tool for determining whether the task is truly completed.
86-
# * `write_memory`: Writes a named memory (for future reference) to Serena's project-specific memory store.
33+
# list of tool names to exclude.
8734
excluded_tools: []
8835

89-
# list of tools to include that would otherwise be disabled (particularly optional tools that are disabled by default)
36+
# list of tools to include that would otherwise be disabled
9037
included_optional_tools: []
9138

92-
# fixed set of tools to use as the base tool set (if non-empty), replacing Serena's default set of tools.
93-
# This cannot be combined with non-empty excluded_tools or included_optional_tools.
39+
# fixed set of tools to use as the base tool set
9440
fixed_tools: []
9541

42+
# initial prompt for the project.
43+
initial_prompt: >
44+
FactoryLM monorepo — industrial AI platform diagnosing factory faults
45+
using NVIDIA Cosmos Reason 2. Key dirs: cosmos/ (client, watcher, agent),
46+
services/matrix/ (FastAPI + SQLite), diagnosis/ (conveyor fault rules),
47+
sim/ (PLC simulator + Factory I/O bridge), core/ (shared Python library).
48+
Pipeline: Factory I/O -> Modbus TCP -> Matrix API -> Cosmos -> Diagnosis.
49+
SAFETY: NEVER modify code tagged # SAFETY, # PLC, or # CRITICAL.
50+
9651
# list of mode names to that are always to be included in the set of active modes
97-
# The full set of modes to be activated is base_modes + default_modes.
98-
# If the setting is undefined, the base_modes from the global configuration (serena_config.yml) apply.
99-
# Otherwise, this setting overrides the global configuration.
100-
# Set this to [] to disable base modes for this project.
101-
# Set this to a list of mode names to always include the respective modes for this project.
10252
base_modes:
10353

10454
# list of mode names that are to be activated by default.
105-
# The full set of modes to be activated is base_modes + default_modes.
106-
# If the setting is undefined, the default_modes from the global configuration (serena_config.yml) apply.
107-
# Otherwise, this overrides the setting from the global configuration (serena_config.yml).
108-
# This setting can, in turn, be overridden by CLI parameters (--mode).
10955
default_modes:
11056

111-
# initial prompt for the project. It will always be given to the LLM upon activating the project
112-
# (contrary to the memories, which are loaded on demand).
113-
initial_prompt: ""
114-
115-
# override of the corresponding setting in serena_config.yml, see the documentation there.
116-
# If null or missing, the value from the global config is used.
57+
# time budget (seconds) per tool call for the retrieval of additional symbol information
11758
symbol_info_budget:
11859

11960
# The language backend to use for this project.
120-
# If not set, the global setting from serena_config.yml is used.
121-
# Valid values: LSP, JetBrains
122-
# Note: the backend is fixed at startup. If a project with a different backend
123-
# is activated post-init, an error will be returned.
12461
language_backend:

agents/serena_agent.py

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
"""FactoryLM Serena Agent — Agno-powered web UI for codebase navigation.
2+
3+
Launch via: doppler run -p factorylm -c dev -- uv run python agents/serena_agent.py --project .
4+
Requires: serena[agno] installed in Desktop/serena venv.
5+
UI: connect Agent UI at http://localhost:3000 to http://localhost:7777
6+
"""
7+
import sys
8+
from pathlib import Path
9+
10+
# Add the serena source to path so we can import it
11+
SERENA_ROOT = Path(__file__).resolve().parent.parent.parent / "serena"
12+
if SERENA_ROOT.exists():
13+
sys.path.insert(0, str(SERENA_ROOT / "src"))
14+
15+
from agno.models.anthropic.claude import Claude
16+
from agno.os import AgentOS
17+
from sensai.util import logging as sensai_logging
18+
19+
from serena.agno import SerenaAgnoAgentProvider
20+
21+
if __name__ == "__main__":
22+
sensai_logging.configure(level=sensai_logging.INFO)
23+
24+
model = Claude(id="claude-sonnet-4-20250514")
25+
26+
serena_agent = SerenaAgnoAgentProvider.get_agent(model)
27+
28+
agent_os = AgentOS(
29+
description="FactoryLM coding assistant — industrial AI codebase navigation",
30+
id="factorylm-serena",
31+
agents=[serena_agent],
32+
)
33+
34+
app = agent_os.get_app()
35+
36+
if __name__ == "__main__":
37+
agent_os.serve(app="serena_agent:app", reload=False)

scripts/start_serena_agent.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/bash
2+
# Start the FactoryLM Serena Agent with Agno web UI
3+
# Requires: serena[agno] installed in ~/Desktop/serena/.venv
4+
# UI: connect Agent UI at http://localhost:3000 to http://localhost:7777
5+
6+
SERENA_ROOT="C:/Users/hharp/OneDrive/Desktop/serena"
7+
FACTORYLM_ROOT="C:/Users/hharp/OneDrive/Desktop/FactoryLM"
8+
9+
cd "$SERENA_ROOT" || exit 1
10+
11+
export SERENA_ROOT
12+
13+
doppler run -p factorylm -c dev -- \
14+
uv run python "$FACTORYLM_ROOT/agents/serena_agent.py" \
15+
--project "$FACTORYLM_ROOT"

0 commit comments

Comments
 (0)