We describe the design of a knowledge-building environment and examine the role of knowledge-building portfolios in characterizing and scaffolding collaborative inquiry. Our goal is to examine collaborative knowledge building in the context of exploring the alignment of learning, collaboration, and assessment in computer forums. The key design principle involved turning over epistemic agency to students; guided by several knowledge-building principles, they were asked to identify clusters of computer notes that indicated knowledge-building episodes in the computer discourse. Three classes of 9th grade students in Hong Kong used Knowledge Forum in several conditions: Knowledge Forum only, Knowledge Forum with portfolios, and Knowledge Forum with portfolios and principles. Results showed: (1) Students working on portfolios guided knowledge-building principles showed deeper inquiry and more conceptual understanding than their counterpart (2) Students' knowledge-building discourse, reflected in portfolio scores, contributed to their domain understanding; and (3) Knowledge-building portfolios helped to assess and foster collective knowledge advances: A portfolio with multiple contributions from students is a group accomplishment that captures the distributed and progressive nature of knowledge building. Students extended their collective understanding by analyzing the discourse, and the portfolio scaffolded the complex interactions between individual and collective knowledge advancements.