In Part 1 of this series, we introduced the concept of AI-human collaborative development. Now, let’s explore the specific technical patterns and processes that make this collaboration effective in practice. One of the core technical challenges in collaborative development is maintaining context across sessions. This evolution represents more than just code refactoring - it’s about creating explicit mechanisms for context preservation and retrieval. The AI can pick up exactly where it left off, even across different sessions or instances.
We’ve developed a specific workflow for file collaboration that maintains consistency between human and AI contributions:
- Human commits changes to Git
- This establishes a clear baseline
- All changes are versioned and traceable
- AI reads current file state
- Direct access to the latest committed version
- No ambiguity about file contents
- AI proposes and writes changes
- Targeted updates to specific files
- Maintains structure and style consistency
- Human reviews in their IDE
- Familiar environment for code review
- Can make adjustments before committing
This pattern ensures that both human and AI are always working from the same baseline, preventing confusion or conflicting changes. The core of our development workflow emerged naturally. For instance when we developed the basic Knowledge Sync Algorithm that we used to sync files and parse semantic content:
async def sync(self, directory: Path) -> None:
"""Sync knowledge files with the database."""
# Get current filesystem state vs DB state
changes = await self.file_scanner.find_changes(directory)
# Delete anything not in filesystem
for path in changes.deleted:
await self.delete_entity(path)
# Process all files that need syncing
parsed_entities = {}
for path in [*changes.new, *changes.modified]:
file_checksum = await self.file_scanner.calculate_checksum(directory / path)
markdown_entity = await self.knowledge_parser.parse_file(directory / path)
parsed_entities[path] = (markdown_entity, file_checksum)
# Create/update entities (without relations)
for path, (markdown_entity, checksum) in parsed_entities.items():
await self.sync_entity_without_relations(path, markdown_entity)
# Process relations
for path, (markdown_entity, checksum) in parsed_entities.items():
await self.sync_entity_relations(path, markdown_entity, checksum)
This algorithm emerged through collaborative iteration. Each decision point represents discussions about trade-offs, edge cases, and performance considerations.
The key design decisions, such as “files as source of truth” and “outgoing relations only,” came from this collaborative process - neither partner could have arrived at them independently as effectively.
Through this work, we’ve discovered several key technical processes that enable effective collaboration:
- File-Based Communication
- Git as the shared record of truth
- Clear ownership and history
- Standard tools for both sides
- Context Preservation
- Explicit context loading and building
- Session state preservation
- Knowledge graph for semantic relationships
- Incremental Implementation
- Small, focused changes
- Frequent testing and verification
- Clear separation of concerns
- Explicit Decision Recording
- Design decisions captured in comments and commits
- Reasoning documented alongside code
- Future reference for both human and AI
These patterns ensure that both parties always have access to the same information and context, minimizing misalignments and maximizing productive collaboration.
We approach implementation in clear phases that play to the strengths of both partners:
- Human: Strategic direction and problem definition
- AI: Initial implementation proposal
- Human: Review, testing, and feedback
- AI: Refinement based on feedback
- Human: Final approval and commit
- Both: Documentation and knowledge capture
This strategy maintains human oversight for critical decisions while leveraging the AI’s ability to produce consistent, well-structured code quickly.
Here’s a simplified example of our collaborative cycle in practice:
# Session 1: Initial Implementation
Human: We need a way to parse Markdown files into structured entities.
AI: I suggest creating a MarkdownParser class with methods for extracting frontmatter, observations, and relations.
Human: Makes sense. What about handling edge cases like malformed Markdown?
AI: Good point. Let me revise with robust error handling...
[Implementation discussion continues]
# Session 2: Testing and Refinement
Human: The parser works well on most files, but we're having an issue with Unicode characters.
AI: [Reading the implementation from git] I see the problem. We're using the wrong encoding. Let me fix that...
Human: Perfect. I'll commit this version.
# Session 3: Extension
AI: [Reading the latest implementation] Now that we have the basic parser working, should we implement the relation extraction functionality?
Human: Yes, but let's make sure it aligns with our knowledge graph model...
[Development continues]
Each session builds on the previous ones, with both participants maintaining a shared understanding of the code and its evolution.
This collaborative model suggests several potential improvements to development tools:
- Better session persistence mechanisms
- Integrated knowledge capture during development
- File-focused collaboration interfaces
- Explicit context management tools
- Versioned development conversations
While we’ve built workarounds using existing tools, future development environments could be designed specifically for this kind of collaborative workflow.
In the final part of this series, we’ll explore the human experience of this collaborative development model and its broader implications for the future of software development.
Want to explore Basic Memory for yourself? Check out our GitHub repository to get started.