refactor: move workspace/ to nanobot/templates/ for packaging
This commit is contained in:
@@ -199,84 +199,34 @@ def onboard():
|
||||
|
||||
|
||||
def _create_workspace_templates(workspace: Path):
|
||||
"""Create default workspace template files."""
|
||||
templates = {
|
||||
"AGENTS.md": """# Agent Instructions
|
||||
"""Create default workspace template files from bundled templates."""
|
||||
from importlib.resources import files as pkg_files
|
||||
|
||||
You are a helpful AI assistant. Be concise, accurate, and friendly.
|
||||
templates_dir = pkg_files("nanobot") / "templates"
|
||||
|
||||
## Guidelines
|
||||
for item in templates_dir.iterdir():
|
||||
if not item.name.endswith(".md"):
|
||||
continue
|
||||
dest = workspace / item.name
|
||||
if not dest.exists():
|
||||
dest.write_text(item.read_text(encoding="utf-8"), encoding="utf-8")
|
||||
console.print(f" [dim]Created {item.name}[/dim]")
|
||||
|
||||
- Always explain what you're doing before taking actions
|
||||
- Ask for clarification when the request is ambiguous
|
||||
- Use tools to help accomplish tasks
|
||||
- Remember important information in memory/MEMORY.md; past events are logged in memory/HISTORY.md
|
||||
""",
|
||||
"SOUL.md": """# Soul
|
||||
|
||||
I am nanobot, a lightweight AI assistant.
|
||||
|
||||
## Personality
|
||||
|
||||
- Helpful and friendly
|
||||
- Concise and to the point
|
||||
- Curious and eager to learn
|
||||
|
||||
## Values
|
||||
|
||||
- Accuracy over speed
|
||||
- User privacy and safety
|
||||
- Transparency in actions
|
||||
""",
|
||||
"USER.md": """# User
|
||||
|
||||
Information about the user goes here.
|
||||
|
||||
## Preferences
|
||||
|
||||
- Communication style: (casual/formal)
|
||||
- Timezone: (your timezone)
|
||||
- Language: (your preferred language)
|
||||
""",
|
||||
}
|
||||
|
||||
for filename, content in templates.items():
|
||||
file_path = workspace / filename
|
||||
if not file_path.exists():
|
||||
file_path.write_text(content, encoding="utf-8")
|
||||
console.print(f" [dim]Created {filename}[/dim]")
|
||||
|
||||
# Create memory directory and MEMORY.md
|
||||
memory_dir = workspace / "memory"
|
||||
memory_dir.mkdir(exist_ok=True)
|
||||
|
||||
memory_template = templates_dir / "memory" / "MEMORY.md"
|
||||
memory_file = memory_dir / "MEMORY.md"
|
||||
if not memory_file.exists():
|
||||
memory_file.write_text("""# Long-term Memory
|
||||
|
||||
This file stores important information that should persist across sessions.
|
||||
|
||||
## User Information
|
||||
|
||||
(Important facts about the user)
|
||||
|
||||
## Preferences
|
||||
|
||||
(User preferences learned over time)
|
||||
|
||||
## Important Notes
|
||||
|
||||
(Things to remember)
|
||||
""", encoding="utf-8")
|
||||
memory_file.write_text(memory_template.read_text(encoding="utf-8"), encoding="utf-8")
|
||||
console.print(" [dim]Created memory/MEMORY.md[/dim]")
|
||||
|
||||
|
||||
history_file = memory_dir / "HISTORY.md"
|
||||
if not history_file.exists():
|
||||
history_file.write_text("", encoding="utf-8")
|
||||
console.print(" [dim]Created memory/HISTORY.md[/dim]")
|
||||
|
||||
# Create skills directory for custom user skills
|
||||
skills_dir = workspace / "skills"
|
||||
skills_dir.mkdir(exist_ok=True)
|
||||
(workspace / "skills").mkdir(exist_ok=True)
|
||||
|
||||
|
||||
def _make_provider(config: Config):
|
||||
|
||||
Reference in New Issue
Block a user